溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Dockerfile制作nginx鏡像

發(fā)布時(shí)間:2020-07-03 19:46:31 來(lái)源:網(wǎng)絡(luò) 閱讀:1173 作者:丁香花下 欄目:系統(tǒng)運(yùn)維

nginx版本為1.16.1,基礎(chǔ)鏡像為alpine-linux,鏡像最終大小為25.7M

FROM?alpine:latest
ENV?ng_config?/usr/local/nginx-1.16.1
ADD?nginx-1.16.1.tar.gz?/usr/local/

RUN?CONFIG="\
--prefix=/usr/local/nginx?\
--user=nginx?\
--group=nginx?\
--with-http_ssl_module?\
--with-http_gzip_static_module?\
--with-http_image_filter_module?\
--with-http_stub_status_module?\
"?\

&&?addgroup?-S?nginx?\
&&?adduser?-D?-S?-h?/var/cache/nginx?-s?/sbin/nologin?-G?nginx?nginx?\
&&?apk?add?--no-cache?--virtual?.build-deps?\
gcc?g++?pcre?pcre-dev?expat-dev?perl?zlib-dev?libxml2-dev?make?openssl?openssl-dev?bzip2-dev?gd?gd-dev?\
&&?rm?-rf?/var/cache/apk/*?\

&&?cd?$ng_config?\
&&?./configure?$CONFIG?\
&&?sed?-ri?"s/-Werror//"?$ng_config/objs/Makefile?\
&&?make?\
&&?make?install?\

#######################清除虛包#########################
&&?runDeps="$(?\
scanelf?--needed?--nobanner?--format?'%n#p'?--recursive?/usr/local?\
|?tr?','?'\n'?\
|?sort?-u?\
|?awk?'system("[?-e?/usr/local/lib/"?$1?"?]")?==?0?{?next?}?{?print?"so:"?$1?}'?\
)"?\
&&?apk?add?--no-cache?$runDeps?\
&&?apk?del??.build-deps?\
&&?rm?-rf?$ng_config
########################################################

expose?80?443
WORKDIR?/usr/local/nginx/
ENTRYPOINT?[?"./sbin/nginx"?,"-g"?,"daemon?off;"]

Dockerfile制作nginx鏡像

Dockerfile制作nginx鏡像

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI