mod_zip
mod_zip copied to clipboard
Official docker image
Hi!
I would like to use your mod, but I could not find a (current) docker image for it.
Would it be possible for you to provide an official docker image and update it somewhat regularly?
I would have used the current official nginx dockerfile as a template, but they don't actually compile nginx, they just download the latest package from the repo.
Instead, the dockerfile would have to be based on Compiling and Installing from Source, I guess...
Or on of the old mod_zip dockerfiles.
Best, MrTomRod
Hi @MrTomRod,
I've found this: https://gist.github.com/muuvmuuv/f1a0e7b6a6a02c2253dc92350eab7607
and used it to create this docker file:
FROM debian:stable AS builder
ARG version='1.21.0'
ARG modules_dir="/nginx_modules/"
ARG build_dir="/usr/share/tmp"
# 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}
RUN mkdir -p ${modules_dir}
# Download NGINX
RUN cd ${build_dir} \
&& wget https://nginx.org/download/nginx-${version}.tar.gz \
&& tar zxf nginx-${version}.tar.gz \
&& rm nginx-${version}.tar.gz
# Download Modules
RUN cd ${build_dir} \
&& git clone --recursive https://github.com/evanmiller/mod_zip mod_zip
# Install modules
RUN cd ${build_dir}/nginx-${version} \
&& ./configure --with-compat \
--add-dynamic-module=../mod_zip \
&& make && make install
# Move compiled modules
RUN ls ${build_dir}/nginx-${version}/objs
RUN cd ${build_dir}/nginx-${version}/objs \
&& cp ngx_http_zip_module.so ${modules_dir} \
&& chmod -R 644 ${modules_dir}
FROM nginx:1.21.0
ARG modules_dir="/nginx_modules/"
COPY --from=builder ${modules_dir}/ngx_http_zip_module.so ${modules_dir}/
I think it does what you want, but it would be great to have a official image for this.
Thanks.
Luc
Small changes as it failed to build on my side (and I use nginxinc/nginx-unprivileged):
FROM debian:stable AS builder
ARG version='1.21.6'
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-${version}.tar.gz \
&& tar zxf nginx-${version}.tar.gz \
&& rm nginx-${version}.tar.gz
# Download Modules
RUN cd ${build_dir} \
&& git clone --recursive https://github.com/evanmiller/mod_zip mod_zip
# Install modules
RUN cd ${build_dir}/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.21.6
ARG nginx_module_dir="/usr/local/nginx/modules/"
COPY --from=builder ${nginx_module_dir}/ngx_http_zip_module.so /etc/nginx/modules/
USER root
RUN chmod 0777 /var/cache/nginx/
USER 101
d-c file :
version: "3.7"
services:
nginx-zip:
image: "nginx-nginx"
hostname: nginx-zip
user: "3050:1050"
read_only: true
build:
context: ..
ports:
- "8080:80"
volumes:
- "./www:/var/www/html:ro"
- "./nginx.conf:/etc/nginx/nginx.conf:ro"
- type: tmpfs
target: /var/cache/nginx/
- type: tmpfs
target: /tmp
And inside nginx.conf : load_module "modules/ngx_http_zip_module.so";
Is that possible to do it on Alpine ?