Last active
November 1, 2024 17:21
-
-
Save mehyedes/bf5e3870907ddb9c9d3c3fe45d68c43d to your computer and use it in GitHub Desktop.
Compiling NGINX module as dynamic module for use in docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:1.14.2 AS builder | |
LABEL maintainer="NGINX Docker Maintainers <[email protected]>" | |
ENV NGINX_VERSION 1.14.2 | |
ENV VTS_VERSION 0.1.18 | |
COPY ./badproxy /etc/apt/apt.conf.d/99fixbadproxy | |
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \ | |
gnupg1 \ | |
ca-certificates \ | |
gcc \ | |
libc-dev \ | |
make \ | |
openssl\ | |
curl \ | |
gnupg \ | |
wget \ | |
libpcre3 libpcre3-dev \ | |
libghc-zlib-dev | |
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \ | |
wget "https://github.com/vozlt/nginx-module-vts/archive/v${VTS_VERSION}.tar.gz" -O vts.tar.gz | |
# Reuse same cli arguments as the nginx:1.14.2 image used to build | |
RUN CONFARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') \ | |
tar -zxC /usr/src -f nginx.tar.gz && \ | |
tar -xzvf "vts.tar.gz" && \ | |
VTS_DIR="$(pwd)/nginx-module-vts-${VTS_VERSION}/" && \ | |
cd /usr/src/nginx-$NGINX_VERSION && \ | |
./configure --with-compat $CONFARGS --add-dynamic-module=$VTS_DIR && \ | |
make && make install | |
FROM nginx:1.14.2 | |
COPY ./docker-entrypoint.sh / | |
ENTRYPOINT ["/docker-entrypoint.sh"] | |
# Copy compiled static module | |
COPY --from=builder /usr/local/nginx/modules/ngx_http_vhost_traffic_status_module.so /usr/local/nginx/modules/ngx_http_vhost_traffic_status_module.so | |
COPY ./ssl/* /etc/nginx/ssl/cert/ | |
COPY ./nginx.conf /etc/nginx/nginx.conf | |
COPY ./default.conf /etc/nginx/conf.d/default.conf | |
COPY ./*.template /etc/nginx/conf.d/ | |
COPY ./server/* /etc/nginx/conf.d/server/ | |
COPY ./map/* /etc/nginx/conf.d/map/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment