fix: Generate ssl certificates in builder image

This commit is contained in:
2025-08-02 22:41:37 +02:00
parent aaee48d8b2
commit e45f946382
+15 -7
View File
@@ -1,16 +1,24 @@
FROM alpine AS cert-builder
RUN apk add --no-cache openssl
# Generate certs during build
RUN mkdir -p /tmp/ssl && \
openssl req -x509 -nodes -days 365 \
-newkey rsa:2048 \
-keyout /tmp/ssl/selfsigned.key \
-out /tmp/ssl/selfsigned.crt \
-subj "/CN=localhost"
FROM nginx:mainline-alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY paths-enabled /etc/nginx/paths-enabled.d
RUN mkdir -p /etc/nginx/ssl && \
openssl req -x509 -nodes -days 365 \
-newkey rsa:2048 \
-subj "/CN=localhost" \
-keyout /etc/nginx/ssl/selfsigned.key \
-out /etc/nginx/ssl/selfsigned.crt \
COPY entrypoint.sh /entrypoint.sh
COPY --from=cert-builder /tmp/ssl/selfsigned.crt /etc/nginx/ssl/selfsigned.crt
COPY --from=cert-builder /tmp/ssl/selfsigned.key /etc/nginx/ssl/selfsigned.key
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]