blob: 2f5ae563ad6ea3893589d8b3792262b07f4bd8c4 [file] [log] [blame]
FROM nginx:1.25-alpine
ARG SELFSIGNED_REQ_HOST
ARG SELFSIGNED_REQ_ALT_NAMES
RUN test "${SELFSIGNED_REQ_HOST}" || { echo "Require SELFSIGNED_REQ_HOST argument."; exit 1; }
RUN \
apk add openssl && \
printf "DE\nHassia\nEschborn\nSource Arcade\nWeb\n${SELFSIGNED_REQ_HOST}\n\n" | \
openssl req -x509 -nodes -days 14 -newkey rsa:2048 \
-addext "subjectAltName = ${SELFSIGNED_REQ_ALT_NAMES}" \
-keyout /etc/ssl/private/sa-selfsigned.key \
-out /etc/ssl/certs/sa-selfsigned.crt && \
apk del openssl
COPY nginx/Dockerfile.entrypoint /nginx-entrypoint
RUN chmod 544 /nginx-entrypoint
ENTRYPOINT ["/bin/sh", "/nginx-entrypoint"]
CMD ["nginx", "-g", "daemon off;"]