forked from notgiven688/webminerpool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
23 lines (20 loc) · 948 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 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
if [[ ! -f "/root/.acme.sh/${DOMAIN}/${DOMAIN}.cer" ]] || ! openssl x509 -checkend 0 -in "/root/.acme.sh/${DOMAIN}/${DOMAIN}.cer"; then
# 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
fi
fi
# Start server
pushd /webminerpool
exec /usr/bin/mono server.exe