Skip to content

Instantly share code, notes, and snippets.

@jseparovic
Created August 29, 2023 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jseparovic/8e011326034b4c2c36a5d2787e69b3d4 to your computer and use it in GitHub Desktop.
Save jseparovic/8e011326034b4c2c36a5d2787e69b3d4 to your computer and use it in GitHub Desktop.
nginx-certbot with fancyindex
FROM jonasal/nginx-certbot:4.3.0-nginx1.25.2 AS builder
ENV NGINX_VERSION 1.25.2
ENV FANCY_INDEX_VERSION 0.5.2
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/aperezdc/ngx-fancyindex/archive/refs/tags/v${FANCY_INDEX_VERSION}.tar.gz" -O ngx-fancyindex-${FANCY_INDEX_VERSION}.tar.gz && \
CONF_ARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') \
tar -zxC /usr/src -f nginx.tar.gz && \
tar -zxC /usr/src -f ngx-fancyindex-${FANCY_INDEX_VERSION}.tar.gz && \
cd /usr/src/nginx-$NGINX_VERSION && \
./configure --with-compat $CONF_ARGS --add-dynamic-module=/usr/src/ngx-fancyindex-${FANCY_INDEX_VERSION} && \
make && make install
FROM jonasal/nginx-certbot:4.3.0-nginx1.25.2
COPY --from=builder /usr/local/nginx/modules/ngx_http_fancyindex_module.so /usr/lib/nginx/modules/ngx_http_fancyindex_module.so
RUN { echo -n 'load_module modules/ngx_http_fancyindex_module.so;'; cat /etc/nginx/nginx.conf; } >/tmp/nginx.conf && mv -f /tmp/nginx.conf /etc/nginx/nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment