added --no-cache for production grade image

This commit is contained in:
db1234719
2025-11-26 20:58:58 +03:30
parent b138601110
commit f7f586898c

View File

@@ -3,8 +3,8 @@ FROM alpine:3.22 AS builder
ENV NGINX_VERSION=1.29.3 ENV NGINX_VERSION=1.29.3
# Build dependencies (the --no-cache has been removed for development reasons add it later after apk add part) # Build dependencies
RUN apk add \ RUN apk add --no-cache \
build-base pcre2-dev zlib-dev openssl-dev linux-headers curl gnupg tar build-base pcre2-dev zlib-dev openssl-dev linux-headers curl gnupg tar
WORKDIR /tmp WORKDIR /tmp
@@ -52,8 +52,9 @@ RUN rm -rf /tmp/* && rm -rf /var/cache/apk/*
FROM alpine:3.22 FROM alpine:3.22
# Runtime dependencies # Runtime dependencies
RUN apk add \ RUN apk add --no-cache \
pcre2 zlib openssl ca-certificates tzdata libcap git 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 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 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 RUN chown -R nginx:nginx /var/cache/nginx /var/run /etc/nginx /usr/share/nginx/html