Nico Huber | 4f21f5c | 2023-07-21 14:19:54 +0000 | [diff] [blame^] | 1 | FROM nginx:1.24-alpine |
Nico Huber | 38c14da | 2023-06-24 16:59:28 +0000 | [diff] [blame] | 2 | |
| 3 | ARG SELFSIGNED_REQ_HOST |
| 4 | ARG SELFSIGNED_REQ_ALT_NAMES |
Nico Huber | f3c7125 | 2023-07-21 13:03:49 +0000 | [diff] [blame] | 5 | RUN test "${SELFSIGNED_REQ_HOST}" || { echo "Require SELFSIGNED_REQ_HOST argument."; exit 1; } |
| 6 | RUN \ |
Nico Huber | 38c14da | 2023-06-24 16:59:28 +0000 | [diff] [blame] | 7 | apk add openssl && \ |
| 8 | printf "DE\nHassia\nEschborn\nSource Arcade\nWeb\n${SELFSIGNED_REQ_HOST}\n\n" | \ |
| 9 | openssl req -x509 -nodes -days 14 -newkey rsa:2048 \ |
| 10 | -addext "subjectAltName = ${SELFSIGNED_REQ_ALT_NAMES}" \ |
| 11 | -keyout /etc/ssl/private/sa-selfsigned.key \ |
| 12 | -out /etc/ssl/certs/sa-selfsigned.crt && \ |
| 13 | apk del openssl |
| 14 | |
Nico Huber | d652872 | 2023-07-01 14:38:39 +0000 | [diff] [blame] | 15 | COPY nginx/Dockerfile.entrypoint /nginx-entrypoint |
| 16 | RUN chmod 544 /nginx-entrypoint |
| 17 | |
| 18 | ENTRYPOINT ["/bin/sh", "/nginx-entrypoint"] |
| 19 | CMD ["nginx", "-g", "daemon off;"] |