From ada1a22495bfe814fa414bfd8a0a8cef09980716 Mon Sep 17 00:00:00 2001 From: will Farrell Date: Fri, 13 Jan 2017 17:05:58 -0700 Subject: [PATCH] dockerfile optimizations --- Dockerfile | 13 +++++++------ README.md | 15 +++++---------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 925ed04..b026dd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -# TODO python 3 not-supported lexicon#68 -FROM library/python:2-alpine +FROM library/alpine:3.5 -# deps - openssl curl sed grep mktemp -RUN apk --no-cache add bash openssl curl git \ +# deps - python openssl curl sed grep mktemp +RUN apk add --no-cache --virtual .build-deps git \ + && apk add --no-cache --virtual .dehydrated-rundeps python py2-pip bash openssl curl \ + && pip install --upgrade pip \ + && pip install dns-lexicon dns-lexicon[route53] dns-lexicon[transip] \ && cd /tmp \ && git clone https://github.com/lukas2511/dehydrated.git --depth 1 \ && chmod a+x dehydrated/dehydrated \ @@ -11,8 +13,7 @@ RUN apk --no-cache add bash openssl curl git \ && chmod a+x lexicon/examples/dehydrated.default.sh \ && mv lexicon/examples/dehydrated.default.sh /usr/bin/dehydrated-dns \ && rm -rf /tmp/* \ - && pip install dns-lexicon dns-lexicon[route53] dns-lexicon[transip] \ - && apk del git + && apk del .build-deps COPY config /etc/dehydrated/config diff --git a/README.md b/README.md index 9745b54..976e17c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ container to generate letsencrypt certs using dehydrated + lexicon [![](https://images.microbadger.com/badges/version/willfarrell/letsencrypt.svg)](http://microbadger.com/images/willfarrell/letsencrypt "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/willfarrell/letsencrypt.svg)](http://microbadger.com/images/willfarrell/letsencrypt "Get your own image badge on microbadger.com") ## Dockerfile -Use to set your own defaults +Use to set your own defaults or overwrite in the command ```Dockerfile FROM willfarrell/letsencrypt:latest @@ -28,7 +28,6 @@ LEXICON_CLOUDFLARE_TOKEN= ## Testing ```bash docker build -t letsencrypt . -docker rm -f letsencrypt # private docker run \ @@ -36,19 +35,16 @@ docker run \ letsencrypt \ dehydrated \ --cron --domain letsencrypt.willfarrell.ca \ - --out /etc/ssl \ --hook dehydrated-dns \ --challenge dns-01 \ --force # public docker run -d \ - --volumes-from nginx_nginx_1 \ --env-file letsencrypt.env \ letsencrypt \ dehydrated \ --cron --domain letsencrypt.willfarrell.ca \ - --out /etc/ssl \ --challenge http-01 \ --force @@ -57,12 +53,13 @@ docker exec -it nginx_nginx_1 /etc/scripts/make_hpkp && /etc/init.d/nginx reload ``` ## Deploy +See https://github.com/willfarrell/docker-nginx for full example ```bash # private docker run \ --volumes-from nginx_nginx_1 \ --env-file letsencrypt.env \ - letsencrypt \ + willfarrell/letsencrypt \ dehydrated \ --cron --domain letsencrypt.willfarrell.ca \ --out /etc/ssl \ @@ -73,14 +70,12 @@ docker run \ docker run -d \ --volumes-from nginx_nginx_1 \ --env-file letsencrypt.env \ - letsencrypt \ + willfarrell/letsencrypt \ dehydrated \ --cron --domain letsencrypt.willfarrell.ca \ --out /etc/ssl \ --challenge http-01 ``` -## TODO -- [ ] Update to python 3 (not-supported lexicon#68) -`certbot/make_letsencrypt_cert` is an alternate method that one could use with the certbot docker image. However dns-01 is not supported. \ No newline at end of file +Note: `certbot/make_letsencrypt_cert` is an alternate method that one could use with the certbot docker image. However dns-01 is not supported. \ No newline at end of file