From ea32743f17d1361096fa81e60ed39211bfe4109b Mon Sep 17 00:00:00 2001 From: Ross Miller Date: Sat, 7 Mar 2026 15:28:46 +0000 Subject: [PATCH] Update --- Dockerfile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2c349dd..5df99a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"