mirror of
https://github.com/2martens/cloud-configuration.git
synced 2026-10-17 16:46:51 +02:00
fix: Start nginx with self-signed certs until real certs are available
This commit is contained in:
@@ -1,4 +1,16 @@
|
|||||||
FROM nginx:mainline-alpine
|
FROM nginx:mainline-alpine
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY paths-enabled /etc/nginx/paths-enabled.d
|
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
|
||||||
|
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CERT_PATH="/etc/letsencrypt/live/api.2martens.de/fullchain.pem"
|
||||||
|
KEY_PATH="/etc/letsencrypt/live/api.2martens.de/privkey.pem"
|
||||||
|
NGINX_CONF="/etc/nginx/nginx.conf"
|
||||||
|
|
||||||
|
if [ -f "$CERT_PATH" ] && [ -f "$KEY_PATH" ]; then
|
||||||
|
echo "✅ Real certificate found — starting full HTTPS Nginx"
|
||||||
|
else
|
||||||
|
echo "⚠️ No certificate found — starting Nginx with self-signed TLS fallback"
|
||||||
|
ln -sf /etc/nginx/ssl/selfsigned.crt /etc/letsencrypt/live/api.2martens.de/fullchain.pem
|
||||||
|
ln -sf /etc/nginx/ssl/selfsigned.key /etc/letsencrypt/live/api.2martens.de/privkey.pem
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec nginx -g 'daemon off;'
|
||||||
Reference in New Issue
Block a user