From d77ba8c122bc478a4114cddf1ebde175c228b8fd Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Sun, 1 Jan 2017 12:58:42 -0800 Subject: [PATCH] Customizations --- Dockerfile | 17 +++++++---------- Makefile | 7 +++++++ crontab | 2 +- docker-compose.yml | 3 ++- scripts/entrypoint.sh | 3 +++ 5 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 Makefile create mode 100644 scripts/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 94bedd6..01242ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,18 @@ -FROM python:2-alpine +FROM python:2 MAINTAINER Henri Dwyer -VOLUME /certs VOLUME /etc/letsencrypt EXPOSE 80 -RUN apk add --no-cache --virtual .build-deps linux-headers gcc musl-dev\ - && apk add --no-cache libffi-dev openssl-dev dialog\ - && pip install certbot\ - && apk del .build-deps\ - && mkdir /scripts +RUN apt update && apt install -y cron +RUN pip install certbot +RUN mkdir /scripts -ADD crontab /etc/crontabs -RUN crontab /etc/crontabs/crontab +ADD ./crontab /etc/cron.d/certbot +RUN crontab /etc/cron.d/certbot COPY ./scripts/ /scripts RUN chmod +x /scripts/run_certbot.sh ENTRYPOINT [] -CMD ["crond", "-f"] +CMD ["/scripts/entrypoint.sh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ea9c5be --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +all: build + +build: Makefile Dockerfile + docker build --squash -t staticfloat/docker-letsencrypt-cron . + +push: build + docker push staticfloat/docker-letsencrypt-cron diff --git a/crontab b/crontab index c8b000b..d0d1317 100644 --- a/crontab +++ b/crontab @@ -1 +1 @@ -0 3 1 */2 * root sh /scripts/run_certbot.sh +0 */12 * * * root sh /scripts/run_certbot.sh diff --git a/docker-compose.yml b/docker-compose.yml index 947dd22..ff0935e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ version: '2' services: + # Example docker-compose service certbot: build: . container_name: certbot @@ -11,5 +12,5 @@ services: - WEBROOT="" - DOMAINS=domain1.com domain2.com - EMAIL=webmaster@domain1.com - - CONCAT=true + - CONCAT=false - SEPARATE=true diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..355854c --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +/scripts/run_certbot.sh +crond -f