Browse Source

dockerfile optimizations

dehydrated-hook-powerdns
will Farrell 8 years ago
parent
commit
ada1a22495
  1. 13
      Dockerfile
  2. 15
      README.md

13
Dockerfile

@ -1,8 +1,10 @@
# TODO python 3 not-supported lexicon#68 FROM library/alpine:3.5
FROM library/python:2-alpine
# deps - openssl curl sed grep mktemp # deps - python openssl curl sed grep mktemp
RUN apk --no-cache add bash openssl curl git \ 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 \ && cd /tmp \
&& git clone https://github.com/lukas2511/dehydrated.git --depth 1 \ && git clone https://github.com/lukas2511/dehydrated.git --depth 1 \
&& chmod a+x dehydrated/dehydrated \ && 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 \ && chmod a+x lexicon/examples/dehydrated.default.sh \
&& mv lexicon/examples/dehydrated.default.sh /usr/bin/dehydrated-dns \ && mv lexicon/examples/dehydrated.default.sh /usr/bin/dehydrated-dns \
&& rm -rf /tmp/* \ && rm -rf /tmp/* \
&& pip install dns-lexicon dns-lexicon[route53] dns-lexicon[transip] \ && apk del .build-deps
&& apk del git
COPY config /etc/dehydrated/config COPY config /etc/dehydrated/config

15
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") [![](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 ## Dockerfile
Use to set your own defaults Use to set your own defaults or overwrite in the command
```Dockerfile ```Dockerfile
FROM willfarrell/letsencrypt:latest FROM willfarrell/letsencrypt:latest
@ -28,7 +28,6 @@ LEXICON_CLOUDFLARE_TOKEN=
## Testing ## Testing
```bash ```bash
docker build -t letsencrypt . docker build -t letsencrypt .
docker rm -f letsencrypt
# private # private
docker run \ docker run \
@ -36,19 +35,16 @@ docker run \
letsencrypt \ letsencrypt \
dehydrated \ dehydrated \
--cron --domain letsencrypt.willfarrell.ca \ --cron --domain letsencrypt.willfarrell.ca \
--out /etc/ssl \
--hook dehydrated-dns \ --hook dehydrated-dns \
--challenge dns-01 \ --challenge dns-01 \
--force --force
# public # public
docker run -d \ docker run -d \
--volumes-from nginx_nginx_1 \
--env-file letsencrypt.env \ --env-file letsencrypt.env \
letsencrypt \ letsencrypt \
dehydrated \ dehydrated \
--cron --domain letsencrypt.willfarrell.ca \ --cron --domain letsencrypt.willfarrell.ca \
--out /etc/ssl \
--challenge http-01 \ --challenge http-01 \
--force --force
@ -57,12 +53,13 @@ docker exec -it nginx_nginx_1 /etc/scripts/make_hpkp && /etc/init.d/nginx reload
``` ```
## Deploy ## Deploy
See https://github.com/willfarrell/docker-nginx for full example
```bash ```bash
# private # private
docker run \ docker run \
--volumes-from nginx_nginx_1 \ --volumes-from nginx_nginx_1 \
--env-file letsencrypt.env \ --env-file letsencrypt.env \
letsencrypt \ willfarrell/letsencrypt \
dehydrated \ dehydrated \
--cron --domain letsencrypt.willfarrell.ca \ --cron --domain letsencrypt.willfarrell.ca \
--out /etc/ssl \ --out /etc/ssl \
@ -73,14 +70,12 @@ docker run \
docker run -d \ docker run -d \
--volumes-from nginx_nginx_1 \ --volumes-from nginx_nginx_1 \
--env-file letsencrypt.env \ --env-file letsencrypt.env \
letsencrypt \ willfarrell/letsencrypt \
dehydrated \ dehydrated \
--cron --domain letsencrypt.willfarrell.ca \ --cron --domain letsencrypt.willfarrell.ca \
--out /etc/ssl \ --out /etc/ssl \
--challenge http-01 --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. Note: `certbot/make_letsencrypt_cert` is an alternate method that one could use with the certbot docker image. However dns-01 is not supported.
Loading…
Cancel
Save