blob: 9809c583a432dcf2dc3fccb993f51a1f5f9fe6f0 [file] [log] [blame]
Nico Huber38c14da2023-06-24 16:59:28 +00001ARG SSL_VARIANT=selfsigned
2ARG NGINX_TAG=1.25-alpine
3
4
5FROM nginx:${NGINX_TAG} as nginx_letsencrypt
6
7ONBUILD RUN echo "Let's encrypt support not implemented yet."; exit 1
8
9
10FROM nginx:${NGINX_TAG} as nginx_selfsigned
11
12ARG SELFSIGNED_REQ_HOST
13ARG SELFSIGNED_REQ_ALT_NAMES
14ONBUILD RUN test "${SELFSIGNED_REQ_HOST}" || { echo "Require SELFSIGNED_REQ_HOST argument."; exit 1; }
15ONBUILD RUN \
16 apk add openssl && \
17 printf "DE\nHassia\nEschborn\nSource Arcade\nWeb\n${SELFSIGNED_REQ_HOST}\n\n" | \
18 openssl req -x509 -nodes -days 14 -newkey rsa:2048 \
19 -addext "subjectAltName = ${SELFSIGNED_REQ_ALT_NAMES}" \
20 -keyout /etc/ssl/private/sa-selfsigned.key \
21 -out /etc/ssl/certs/sa-selfsigned.crt && \
22 apk del openssl
23
24
25FROM nginx_${SSL_VARIANT}
Nico Huberd6528722023-07-01 14:38:39 +000026
27COPY nginx/Dockerfile.entrypoint /nginx-entrypoint
28RUN chmod 544 /nginx-entrypoint
29
30ENTRYPOINT ["/bin/sh", "/nginx-entrypoint"]
31CMD ["nginx", "-g", "daemon off;"]