diff --git a/Dockerfile b/Dockerfile index adca137..5f6890c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,24 @@ RUN sed -ri "s/^(.*DonationLevel = )[0-9]\.[0-9]{2}/\1${DONATION_LEVEL}/" /serve cd /server && \ msbuild Server.sln /p:Configuration=Release_Server /p:Platform="any CPU" - -VOLUME ["/root"] FROM mono:5.16 RUN mkdir /webminerpool + +# Install acme.sh +RUN apt-get -qq update && \ + apt-get install -qq \ + coreutils \ + cron \ + curl \ + git \ + openssl \ + socat && \ + rm -rf /var/lib/apt/lists/* && \ + git clone https://github.com/Neilpang/acme.sh.git /root/acme.sh && \ + cd /root/acme.sh && \ + git checkout 2.7.9 && \ + /root/acme.sh/acme.sh --install --home /root/.acme.sh COPY entrypoint.sh /entrypoint.sh COPY --from=webminerpool-build /server/Server/bin/Release_Server/server.exe /webminerpool COPY --from=webminerpool-build /server/Server/bin/Release_Server/pools.json /webminerpool diff --git a/entrypoint.sh b/entrypoint.sh index dece977..28b56bc 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,33 +1,21 @@ #!/usr/bin/env bash +set -o errexit +set -o pipefail +set -o nounset + # Check if $DOMAIN is set if [ -z $DOMAIN ]; then - echo -e "You need to set \$DOMAIN variable at run time\n" - echo -e "For example: docker run -d -p 80:80 -p 443:443 -e DOMAIN=example.com\n" - exit 1 + echo -e "You did not set \$DOMAIN variable at run time. No certificate will be registered.\n" + echo -e "If you want to define it on command line here is an example:\n" + echo -e "docker run -d -p 80:80 -p 443:443 -e DOMAIN=example.com\n" else - # Install acme.sh - apt-get -qq update - apt-get install -qq \ - cron \ - openssl \ - curl \ - coreutils \ - socat \ - git - git clone https://github.com/Neilpang/acme.sh.git /root/acme.sh && \ - cd /root/acme.sh && \ - git checkout 2.7.8 && \ - /root/acme.sh/acme.sh --install - # Generate SSL cert /root/.acme.sh/acme.sh --issue --standalone -d ${DOMAIN} -d www.${DOMAIN} - # Generate pfx openssl pkcs12 -export -out /webminerpool/certificate.pfx -inkey /root/.acme.sh/${DOMAIN}/${DOMAIN}.key -in /root/.acme.sh/${DOMAIN}/${DOMAIN}.cer -certfile /root/.acme.sh/${DOMAIN}/fullchain.cer -passin pass:miner -passout pass:miner - - # Start server - pushd /webminerpool - exec /usr/bin/mono server.exe - fi + +# Start server +pushd /webminerpool +exec /usr/bin/mono server.exe