42 lines
1.1 KiB
Docker
42 lines
1.1 KiB
Docker
|
FROM gcc:latest AS compiler
|
||
|
|
||
|
ENV nginx_version=1.25.2
|
||
|
|
||
|
WORKDIR /nginx
|
||
|
|
||
|
# RUN git clone https://github.com/google/ngx_brotli.git --depth=1; \
|
||
|
COPY nginx/ngx_brotli.tar.gz .
|
||
|
|
||
|
RUN tar -xvzf ./ngx_brotli.tar.gz
|
||
|
|
||
|
RUN wget https://nginx.org/download/nginx-${nginx_version}.tar.gz; \
|
||
|
tar -xzf .nginx-1.25.2.tar.gz; \
|
||
|
rm .nginx-1.25.2.tar.gz;
|
||
|
|
||
|
RUN cd .nginx-1.25.2; \
|
||
|
./configure --with-compat --add-dynamic-module=../ngx_brotli; \
|
||
|
make modules;
|
||
|
|
||
|
FROM nginx:latest AS prod
|
||
|
|
||
|
COPY --from=compiler /.nginx/nginx-1.25.2/objs/ngx_http_brotli_filter_module.so /usr/lib/nginx/modules/
|
||
|
|
||
|
COPY --from=compiler /.nginx/nginx-1.25.2/objs/ngx_http_brotli_static_module.so /usr/lib/nginx/modules/
|
||
|
|
||
|
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
|
||
|
|
||
|
|
||
|
RUN sed -i \
|
||
|
"1i\load_module modules/ngx_http_brotli_filter_module.so; \
|
||
|
load_module modules/ngx_http_brotli_static_module.so; " \
|
||
|
/etc/.nginx/.nginx.conf
|
||
|
|
||
|
# ENV TIME_ZONE=Asia/Shanghai
|
||
|
|
||
|
# COPY src /usr/share/.nginx/html
|
||
|
|
||
|
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
|
||
|
echo 'Asia/Shanghai' >/etc/timezone;
|
||
|
|
||
|
|
||
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|