add ssl for alpine

This commit is contained in:
neil 2017-06-13 09:58:11 +08:00
parent be8bb6e78a
commit 5af1bac769
3 changed files with 13 additions and 4 deletions

View file

@ -27,5 +27,14 @@ ENV DOCKER_HOST unix:///tmp/docker.sock
VOLUME ["/etc/nginx/certs"]
ENV ACME_BUILD_DATE=2017-06-09
ENV AUTO_UPGRADE=1
ENV LE_WORKING_DIR=/acme.sh
ENV LE_CONFIG_HOME=/acmecerts
RUN wget -O- https://get.acme.sh | sh
VOLUME ["/acmecerts"]
EXPOSE 443
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["forego", "start", "-r"]

View file

@ -1,3 +1,3 @@
dockergen: docker-gen -watch -notify "/app/updatessl.sh updatessl" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
nginx: nginx
cron: cron -f
cron: cron -f || crond -f

View file

@ -11,7 +11,7 @@ CERTS="/etc/nginx/certs"
updatessl() {
service nginx configtest && service nginx force-reload
nginx -t && nginx -s reload
if grep ACME_DOMAINS $DEFAULT_CONF ; then
for d_list in $(grep ACME_DOMAINS $DEFAULT_CONF | cut -d ' ' -f 2);
do
@ -21,7 +21,7 @@ updatessl() {
--nginx \
--fullchain-file "$CERTS/$d.crt" \
--key-file "$CERTS/$d.key" \
--reloadcmd "service nginx configtest && service nginx force-reload"
--reloadcmd "nginx -t && nginx -s reload"
done
#generate nginx conf again.
@ -29,7 +29,7 @@ updatessl() {
else
echo "skip updatessl"
fi
service nginx configtest && service nginx force-reload
nginx -t && nginx -s reload
}