This commit is contained in:
rossmill76 committed 2026-03-07 15:28:46 +00:00
1 parent 3ca8082deb
commit ea32743f17
1 file changed
+7 -13
+7 -13
View File
@@ -36,30 +36,24 @@ RUN mkdir -p /app/data
ENV Hsts__Domain=nas.oneputleygreen.com
# Copy the SSL certificate (CN=nas.oneputleygreen.com).
# Place cert.pfx in certs/ before building — excluded from git via certs/* in .gitignore.
# If cert.pfx is absent (e.g. CI builds) a self-signed fallback is generated automatically.
# Place cert.pem and key.pem in certs/ before building — excluded from git via certs/* in .gitignore.
# If cert.pem is absent (e.g. CI builds) a self-signed fallback is generated automatically.
COPY certs/ /app/certs/
RUN if [ ! -f /app/certs/cert.pfx ]; then \
echo "No cert.pfx found — generating self-signed certificate for ${Hsts__Domain}" && \
RUN if [ ! -f /app/certs/cert.pem ]; then \
echo "No cert.pem found — generating self-signed certificate for ${Hsts__Domain}" && \
openssl req -x509 -newkey rsa:4096 \
-keyout /app/certs/key.pem \
-out /app/certs/cert.pem \
-days 3650 \
-nodes \
-subj "/C=GB/ST=England/O=Budgeteer/CN=${Hsts__Domain}" && \
openssl pkcs12 -export \
-out /app/certs/cert.pfx \
-inkey /app/certs/key.pem \
-in /app/certs/cert.pem \
-passout pass: && \
rm /app/certs/key.pem /app/certs/cert.pem; \
-subj "/C=GB/ST=England/O=Budgeteer/CN=${Hsts__Domain}"; \
fi
# Serve on both HTTP and HTTPS
ENV ASPNETCORE_HTTP_PORTS=8181
ENV ASPNETCORE_HTTPS_PORTS=8282
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/app/certs/cert.pfx
ENV ASPNETCORE_Kestrel__Certificates__Default__Password=""
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/app/certs/cert.pem
ENV ASPNETCORE_Kestrel__Certificates__Default__KeyPath=/app/certs/key.pem
# Store the database in the volume-mountable /app/data directory
ENV ConnectionStrings__DefaultConnection="Data Source=/app/data/budgetapp.db"