-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (37 loc) · 1.14 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
FROM python:3.11-alpine as base
# update os
RUN apk add --no-cache --virtual .build-deps \
gcc \
linux-headers \
openssl-dev \
musl-dev \
libffi-dev \
python3-dev \
cargo \
git \
pkgconfig
# install certbot
RUN python3 -m venv /opt/certbot/ && \
/opt/certbot/bin/pip install --upgrade pip && \
/opt/certbot/bin/pip install certbot certbot-nginx && \
/opt/certbot/bin/pip install pyOpenSSL==23.1.1 && \
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
# make runtime
FROM python:3.11-alpine as runtime
COPY --from=base /opt/certbot /opt/certbot
RUN apk add --no-cache \
bash \
nginx
RUN ln -s /opt/certbot/bin/certbot /usr/bin/certbot
EXPOSE 80 443
# make the certs in a volume to persist during restarts
VOLUME /etc/letsencrypt
# copy in our execution script
COPY src/* /root/
# healthcheck that isn't useful on podman
HEALTHCHECK --timeout=3s \
CMD curl -f http://localhost/ || exit 1
# link our logs
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
# start the container process
CMD ["bash","/root/nginx_run.sh"]