From f7f586898c50a8c9906a1ea1a20896d05c602cf8 Mon Sep 17 00:00:00 2001 From: db1234719 Date: Wed, 26 Nov 2025 20:58:58 +0330 Subject: [PATCH] added --no-cache for production grade image --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e8acbb..ab69d28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.22 AS builder ENV NGINX_VERSION=1.29.3 -# Build dependencies (the --no-cache has been removed for development reasons add it later after apk add part) -RUN apk add \ +# Build dependencies +RUN apk add --no-cache \ build-base pcre2-dev zlib-dev openssl-dev linux-headers curl gnupg tar WORKDIR /tmp @@ -52,8 +52,9 @@ RUN rm -rf /tmp/* && rm -rf /var/cache/apk/* FROM alpine:3.22 # Runtime dependencies -RUN apk add \ +RUN apk add --no-cache \ pcre2 zlib openssl ca-certificates tzdata libcap git + RUN addgroup -S nginx && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx RUN mkdir -p /var/cache/nginx /etc/nginx/conf.d /etc/nginx/stream_conf.d /usr/share/nginx/html /var/run RUN chown -R nginx:nginx /var/cache/nginx /var/run /etc/nginx /usr/share/nginx/html