change to s6

This commit is contained in:
2023-06-20 21:27:01 +00:00
parent da97eed84e
commit df6719d802
26 changed files with 210 additions and 113 deletions

View File

@ -1,18 +1,15 @@
FROM alpine:latest as base
ARG TARGETARCH
RUN apt update && apt install -y bash cron python3 python3-venv procps tini
FROM base AS base-amd64
ENV S6_OVERLAY_ARCH=x86_64
RUN python3 -m venv /opt/certbot/ && /opt/certbot/bin/pip install --upgrade pip
FROM base AS base-arm64
ENV S6_OVERLAY_ARCH=aarch64
RUN /opt/certbot/bin/pip install certbot certbot-dns-cloudflare && \
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
FROM base-${TARGETARCH}${TARGETVARIANT}
RUN mkdir -p /config
COPY run.sh / renew.sh /
RUN chmod +x /run.sh /renew.sh
ARG S6_OVERLAY_VERSION=3.1.5.0
ENV DOMAINS=
ENV EMAIL=
@ -27,5 +24,31 @@ ENV PGID=1000
#Get required packages
RUN apk update && apk add curl bash python3 py3-virtualenv procps tzdata nano shadow xz busybox-suid openssl
ENTRYPOINT ["/usr/bin/tini", "-s", "/run.sh"]
#Make folders
RUN mkdir /config && \
mkdir /app && \
#Create default user
useradd -u 1000 -U -d /config -s /bin/false mrmeeb && \
usermod -G users mrmeeb
#Install s6-overlay
RUN curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" | tar Jpxf - -C / && \
curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz" | tar Jpxf - -C / && \
curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" | tar Jpxf - -C / && \
curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" | tar Jpxf - -C /
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 S6_VERBOSITY=1
RUN python3 -m venv /app/certbot/ && /app/certbot/bin/pip install --upgrade pip
RUN /app/certbot/bin/pip install certbot certbot-dns-cloudflare && \
ln -s /app/certbot/bin/certbot /usr/bin/certbot
COPY root /
RUN chmod +x /container-init.sh && \
chmod +x /certbot-prepare.sh && \
chmod +x /certbot-renew.sh && \
chown -R ${PUID}:${PGID} /app /config
ENTRYPOINT [ "/init" ]