-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (43 loc) · 1.35 KB
/
Dockerfile
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
46
47
48
49
50
51
52
53
54
FROM debian:stable AS builder
LABEL maintainer="Matt Campbell <mcampbell@coreweave.com>"
ARG UID=101
ARG MOD_ZIP_VERSION=5b2604b3914f87db2077f2239b8a98b66cf622af
ARG NGINX_VERSION=1.23.1
ARG build_dir="/usr/share/tmp"
ARG nginx_module_dir="/usr/local/nginx/modules/"
# Setup
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
wget \
git \
build-essential \
libpcre3-dev \
zlib1g-dev \
libzstd-dev
RUN mkdir -p ${build_dir}
# Download NGINX
RUN cd ${build_dir} \
&& wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
&& tar zxf nginx-${NGINX_VERSION}.tar.gz \
&& rm nginx-${NGINX_VERSION}.tar.gz
# Download Modules
RUN cd ${build_dir} \
&& git clone --recursive https://github.com/evanmiller/mod_zip mod_zip \
&& cd mod_zip \
&& git checkout $MOD_ZIP_VERSION
# Install modules
RUN cd ${build_dir}/nginx-${NGINX_VERSION} \
&& ./configure --with-compat \
--add-dynamic-module=../mod_zip \
&& make && make install
# Move compiled modules
RUN chmod -R 644 ${nginx_module_dir}
FROM nginxinc/nginx-unprivileged:1.23.1
ARG UID
ARG nginx_module_dir="/usr/local/nginx/modules/"
COPY --from=builder ${nginx_module_dir}/ngx_http_zip_module.so /etc/nginx/modules/
RUN sed -i '1iload_module "modules/ngx_http_zip_module.so";' /etc/nginx/nginx.conf
USER root
RUN chmod 0777 /var/cache/nginx/
USER $UID