diff --git a/Dockerfile b/Dockerfile index ba34f15..c0776f4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -56,10 +56,6 @@ RUN set -e && \ FROM mcr.microsoft.com/dotnet/aspnet:9.0 -WORKDIR / -COPY cert-gen.sh /cert-gen.sh -RUN chmod +x /cert-gen.sh - WORKDIR /app ENV ASPNETCORE_HTTP_PORTS=5000 @@ -77,6 +73,7 @@ COPY --from=build-backend /app/publish ./ # Copy in the client COPY --from=build-frontend /debug/wwwroot ./wwwroot/ +# Copy in the entryscript and run COPY docker-entrypoint.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/cert-gen.sh b/cert-gen.sh index 3b7f52a..13f4793 100644 --- a/cert-gen.sh +++ b/cert-gen.sh @@ -1,4 +1,2 @@ #!/bin/sh -openssl genrsa -out private_key.pem 2048 -openssl rsa -in private_key.pem -pubout -out public_key.pem \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c997905..a4a01b5 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/sh # Copy certs-gen.sh into the mounted /certs volume if it doesn't exist -if [ ! -f /certs/cert-gen.sh ]; then - cp /cert-gen.sh /certs/cert-gen.sh - chmod +x /certs/cert-gen.sh +if [ ! -f /certs/private_key.pem ]; then + echo "Generating RSA key pair..." + openssl genrsa -out /certs/private_key.pem 2048 + openssl rsa -in /certs/private_key.pem -pubout -out public_key.pem fi # Launch the application