forked from nginxinc/nginx-s3-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.oss
45 lines (41 loc) · 2.5 KB
/
Dockerfile.oss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM nginxinc/nginx-s3-gateway
ENV BROTLI_VERSION "v1.0.0rc"
# Build Brotli module from source because there is no repository package
RUN set -eux \
export DEBIAN_FRONTEND=noninteractive; \
apt-get update -qq; \
apt-get install -y -qq build-essential libpcre3-dev git libbrotli1 libbrotli-dev; \
curl -o /tmp/nginx.tar.gz --retry 6 -Ls "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz"; \
mkdir /tmp/nginx /tmp/brotli; \
tar -C /tmp/nginx --strip-components 1 -xzf /tmp/nginx.tar.gz; \
curl -o /tmp/brotli.tar.gz --retry 6 -Ls "https://github.com/google/ngx_brotli/archive/${BROTLI_VERSION}.tar.gz"; \
tar -C "/tmp/brotli" --strip-components 1 -xzf /tmp/brotli.tar.gz; \
cd /tmp/nginx; \
./configure --add-dynamic-module=/tmp/brotli \
--without-http_gzip_module \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx --group=nginx --with-compat --with-file-aio \
--with-threads \
--with-compat \
--with-cc-opt="-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-${NGINX_VERSION}/debian/debuild-base/nginx-${NGINX_VERSION}=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC" \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'; \
make -j $(nproc) modules; \
cp /tmp/nginx/objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules; \
cp /tmp/nginx/objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules; \
apt-get purge -y --auto-remove build-essential libpcre3-dev git libbrotli-dev; \
rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*
# Update configuration to load module
RUN sed -i '1s#^#load_module modules/ngx_http_brotli_filter_module.so;\n\n#' /etc/nginx/nginx.conf
COPY etc/nginx/conf.d /etc/nginx/conf.d