From de4cb3d2b06171825e0df97414e1c3ac80e1cc73 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Mon, 25 Dec 2023 19:16:10 +0100 Subject: [PATCH 1/3] refactor: move nginx daemon off to procfile --- Dockerfile.alpine | 3 +-- Dockerfile.debian | 3 +-- app/Procfile | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 2fb2cda..b94f067 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -21,8 +21,7 @@ RUN apk add --no-cache --virtual .run-deps \ && update-ca-certificates # Configure Nginx -RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ - && sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ +RUN sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ && sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ && mkdir -p '/etc/nginx/dhparam' diff --git a/Dockerfile.debian b/Dockerfile.debian index 2b7801c..99e16d9 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -20,8 +20,7 @@ RUN apt-get update \ && rm -r /var/lib/apt/lists/* # Configure Nginx -RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ - && sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ +RUN sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ && sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ && mkdir -p '/etc/nginx/dhparam' diff --git a/app/Procfile b/app/Procfile index 29fe166..f23e0f4 100644 --- a/app/Procfile +++ b/app/Procfile @@ -1,2 +1,2 @@ dockergen: docker-gen -watch -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf -nginx: nginx +nginx: nginx -g "daemon off;" From 758b43a5b2c71501b7683f094be97eb8755a0a51 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Mon, 25 Dec 2023 19:18:00 +0100 Subject: [PATCH 2/3] refactor: remove unneeded nginx.conf modification the upstream nginx.conf already has "worker_processes auto;" --- Dockerfile.alpine | 3 +-- Dockerfile.debian | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile.alpine b/Dockerfile.alpine index b94f067..f402e05 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -21,8 +21,7 @@ RUN apk add --no-cache --virtual .run-deps \ && update-ca-certificates # Configure Nginx -RUN sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ - && sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ +RUN sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ && mkdir -p '/etc/nginx/dhparam' # Install Forego + docker-gen diff --git a/Dockerfile.debian b/Dockerfile.debian index 99e16d9..e13f324 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -20,8 +20,7 @@ RUN apt-get update \ && rm -r /var/lib/apt/lists/* # Configure Nginx -RUN sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf \ - && sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ +RUN sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ && mkdir -p '/etc/nginx/dhparam' # Install Forego + docker-gen From eb9fca85cf50f0d42a7dcd0741e26d3c3674c414 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Mon, 25 Dec 2023 19:19:57 +0100 Subject: [PATCH 3/3] refactor: remove already present or unneeded dependencies --- Dockerfile.alpine | 6 +----- Dockerfile.debian | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Dockerfile.alpine b/Dockerfile.alpine index f402e05..864aed5 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -14,11 +14,7 @@ ENV NGINX_PROXY_VERSION=${NGINX_PROXY_VERSION} \ DOCKER_HOST=unix:///tmp/docker.sock # Install dependencies -RUN apk add --no-cache --virtual .run-deps \ - bash \ - ca-certificates \ - openssl \ - && update-ca-certificates +RUN apk add --no-cache --virtual .run-deps bash # Configure Nginx RUN sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ diff --git a/Dockerfile.debian b/Dockerfile.debian index e13f324..69114bc 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -13,12 +13,6 @@ ENV NGINX_PROXY_VERSION=${NGINX_PROXY_VERSION} \ DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \ DOCKER_HOST=unix:///tmp/docker.sock -# Install/update certificates -RUN apt-get update \ - && apt-get install -y -q --no-install-recommends ca-certificates \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* - # Configure Nginx RUN sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \ && mkdir -p '/etc/nginx/dhparam'