forked from tomdess/docker-haproxy-certbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (45 loc) · 1.66 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# start from debian 10 slim version
FROM debian:buster-slim
# install certbot, supervisor and utilities
RUN apt-get update && apt-get install --no-install-recommends -yqq \
gnupg \
apt-transport-https \
cron \
wget \
ca-certificates \
curl \
procps \
&& apt-get install --no-install-recommends -yqq certbot \
&& apt-get install --no-install-recommends -yqq supervisor \
&& apt-get clean autoclean && apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# install haproxy from official debian repos (https://haproxy.debian.net/)
RUN curl https://haproxy.debian.net/bernat.debian.org.gpg | apt-key add -
RUN echo deb http://haproxy.debian.net buster-backports-2.2 main | tee /etc/apt/sources.list.d/haproxy.list
RUN apt-get update \
&& apt-get install -yqq haproxy=2.2.\* \
&& apt-get clean autoclean && apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# supervisord configuration
COPY conf/supervisord.conf /etc/supervisord.conf
# haproxy configuration
COPY conf/haproxy.cfg /etc/haproxy/haproxy.cfg
COPY haproxy-acme-validation-plugin/acme-http01-webroot.lua /etc/haproxy
# renewal script
COPY scripts/cert-renewal-haproxy.sh /
# renewal cron job
COPY conf/crontab.txt /var/crontab.txt
# install cron job and remove useless ones
RUN crontab /var/crontab.txt && chmod 600 /etc/crontab \
&& rm -f /etc/cron.d/certbot \
&& rm -f /etc/cron.hourly/* \
&& rm -f /etc/cron.daily/* \
&& rm -f /etc/cron.weekly/* \
&& rm -f /etc/cron.monthly/*
# cert creation script & bootstrap
COPY scripts/certs.sh /
COPY scripts/bootstrap.sh /
RUN mkdir /jail
EXPOSE 80 443
VOLUME /etc/letsencrypt
ENTRYPOINT ["/bootstrap.sh"]