blob: 4114ba139e0608464a6afc35ef6c96c32551de37 [file] [log] [blame]
FROM nginx:1.24-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;"]