docker-static/Dockerfile

35 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2022-05-31 13:10:51 +00:00
# BUILDER
2024-07-31 19:10:01 +00:00
FROM alpine:3 AS builder
2019-08-10 20:46:44 +00:00
2024-07-31 19:10:01 +00:00
ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev curl"
2019-08-10 20:46:44 +00:00
RUN apk add --no-cache ${DEP_DEV}
WORKDIR /build
2024-07-31 19:10:01 +00:00
ARG NGINX
2019-08-10 20:46:44 +00:00
RUN curl https://nginx.org/download/nginx-${NGINX}.tar.gz | tar xz
RUN mv nginx-${NGINX} nginx
RUN git clone --recursive https://github.com/google/ngx_brotli.git
WORKDIR /build/nginx
2022-11-01 19:29:02 +00:00
ARG NGINX_MODULES="--with-http_realip_module --with-threads --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_secure_link_module"
2019-08-10 20:46:44 +00:00
RUN ./configure ${NGINX_MODULES} --add-module=../ngx_brotli
2022-05-31 13:10:51 +00:00
RUN make
RUN make install
2019-08-10 20:46:44 +00:00
2022-05-31 13:10:51 +00:00
# RUNNER
2019-08-10 20:46:44 +00:00
FROM alpine
ARG DEP_RUN="pcre openssl gd tzdata"
COPY --from=builder /usr/local/nginx /usr/local/nginx
RUN apk add --no-cache ${DEP_RUN} \
&& ln -sf /dev/stdout /usr/local/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/nginx/logs/error.log
COPY ./conf/nginx.conf /usr/local/nginx/conf/nginx.conf
COPY ./conf/default.conf /usr/local/nginx/conf/sites/default.conf
EXPOSE 80
STOPSIGNAL SIGTERM
2021-10-17 17:14:35 +00:00
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]