5
5
ENV NGINX_VERSION 1.15.12
6
6
7
7
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
8
+ # Nginx Build Config
8
9
&& CONFIG="\
9
- --add-module=.. /ngx_brotli \
10
+ --add-module=/usr/src /ngx_brotli \
10
11
--prefix=/etc/nginx \
11
12
--sbin-path=/usr/sbin/nginx \
12
13
--modules-path=/usr/lib/nginx/modules \
@@ -51,8 +52,10 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
51
52
--with-file-aio \
52
53
--with-http_v2_module \
53
54
" \
55
+ # Nginx will be run under user nginx:nginx
54
56
&& addgroup -S nginx \
55
57
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
58
+ # Installing build dependencies
56
59
&& apk add --no-cache --virtual .build-deps \
57
60
gcc \
58
61
libc-dev \
@@ -67,6 +70,9 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
67
70
gd-dev \
68
71
geoip-dev \
69
72
git \
73
+ && mkdir -p /usr/src \
74
+ && cd /usr/src \
75
+ && echo "Downloading Nginx" \
70
76
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
71
77
&& curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc -o nginx.tar.gz.asc \
72
78
# Verifying Nginx
@@ -84,14 +90,14 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
84
90
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
85
91
gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
86
92
&& rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
87
- && mkdir -p /usr/src \
88
93
&& tar -zxC /usr/src -f nginx.tar.gz \
89
94
&& rm -f nginx.tar.gz \
90
95
# Downloading Brotli
96
+ && echo "Downloading Brotli" \
91
97
&& cd /usr/src \
92
- && git clone https://github.com/google/ngx_brotli.git \
93
- && cd ngx_brotli \
94
- && git submodule update --init \
98
+ && git clone --recursive https://github.com/google/ngx_brotli.git \
99
+ # Building Nginx
100
+ && echo "Building Nginx" \
95
101
&& cd /usr/src/nginx-$NGINX_VERSION \
96
102
&& ./configure $CONFIG --with-debug \
97
103
&& make -j$(getconf _NPROCESSORS_ONLN) \
@@ -148,8 +154,8 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
148
154
COPY nginx.conf /etc/nginx/nginx.conf
149
155
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
150
156
151
- EXPOSE 80
157
+ EXPOSE 80 443
152
158
153
159
STOPSIGNAL SIGTERM
154
160
155
- CMD ["nginx" , "-g" , "daemon off;" ]
161
+ CMD ["nginx" , "-g" , "daemon off;" ]
0 commit comments