docker-nginx-certbot icon indicating copy to clipboard operation
docker-nginx-certbot copied to clipboard

Adding nginx-extra

Open andrei93r opened this issue 2 years ago • 5 comments

Hi,

I saw that the following package https://packages.debian.org/bullseye/nginx-extras contains a lot of free extra utils on nginx. Was wondering if you can include it by default in your build ?

andrei93r avatar Nov 19 '22 01:11 andrei93r

This has been asked once before, and there is some issues with downloading these packages via APT: https://github.com/JonasAlfredsson/docker-nginx-certbot/issues/50

I have not had time to investigate this much further, but I will happily take any help I can get with figuring out how to include these extra packages in both the Debian and Alpine images :)

JonasAlfredsson avatar Nov 19 '22 08:11 JonasAlfredsson

Adding some interesting links here for the future:

  • https://gist.github.com/hermanbanken/96f0ff298c162a522ddbba44cad31081
  • https://gist.github.com/mehyedes/bf5e3870907ddb9c9d3c3fe45d68c43d
  • https://www.nginx.com/resources/wiki/modules/

JonasAlfredsson avatar Dec 09 '22 20:12 JonasAlfredsson

@JonasAlfredsson Thanks for the tip! Worked for me to add fancyindex https://gist.github.com/jseparovic/8e011326034b4c2c36a5d2787e69b3d4 Cheers!

jseparovic avatar Aug 29 '23 06:08 jseparovic

Based on @jseparovic previous comment I've added headers-more module to my setup like this :

FROM jonasal/nginx-certbot:4.3.0-nginx1.25.2 AS builder

ENV NGINX_VERSION 1.25.2
ENV HEADER_MORE_VERSION 0.33

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 \
  unzip \
  libghc-zlib-dev

RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
    wget "https://github.com/dvershinin/headers-more-nginx-module/archive/refs/tags/v${HEADER_MORE_VERSION}.zip" -O ngx-header-more-${HEADER_MORE_VERSION}.zip && \
    CONF_ARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') \
    tar -zxC /usr/src -f nginx.tar.gz && \
    unzip ngx-header-more-${HEADER_MORE_VERSION} -d /usr/src && \
    cd /usr/src/nginx-$NGINX_VERSION && \
    ./configure --with-compat $CONF_ARGS --add-dynamic-module=/usr/src/headers-more-nginx-module-${HEADER_MORE_VERSION} && \
    make && make install

FROM jonasal/nginx-certbot:4.3.0-nginx1.25.2

COPY --from=builder /usr/local/nginx/modules/ngx_http_headers_more_filter_module.so /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so

RUN { echo -n 'load_module modules/ngx_http_headers_more_filter_module.so;'; cat /etc/nginx/nginx.conf; } >/tmp/nginx.conf && mv -f /tmp/nginx.conf /etc/nginx/nginx.conf

EDIT : If you guys want to test it : https://hub.docker.com/repository/docker/yannick7fr/nginx-certbot-custom/general

YannickLevadoux avatar Sep 23 '23 20:09 YannickLevadoux

Very nice! Glad to see that you were able to get this working. It is a really big project, but one day it would be nice to create a separate pre-built container with all of these modules included.

JonasAlfredsson avatar Oct 04 '23 19:10 JonasAlfredsson