Skip to content

Commit 7866c19

Browse files
authored
feat(docker): automated certificate renewal with certbot (pterodactyl#3916)
* feat(docker): automated certificate renewal with certbot Executes cron on the first day of every month at 23:00 to reduce the load on LE when everyone else is doing it at 00. Certificate that expires in less than 30 days will be renewed. closes pterodactyl#3907
1 parent 0a4ba6a commit 7866c19

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FROM --platform=$TARGETOS/$TARGETARCH php:7.4-fpm-alpine
1414
WORKDIR /app
1515
COPY . ./
1616
COPY --from=0 /app/public/assets ./public/assets
17-
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot \
17+
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot certbot-nginx \
1818
&& docker-php-ext-configure zip \
1919
&& docker-php-ext-install bcmath gd pdo_mysql zip \
2020
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
@@ -27,6 +27,7 @@ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar un
2727

2828
RUN rm /usr/local/etc/php-fpm.conf \
2929
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
30+
&& echo "0 23 * * * certbot renew --nginx --quiet" >> /var/spool/cron/crontabs/root \
3031
&& sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \
3132
&& mkdir -p /var/run/php /var/run/nginx
3233

@@ -35,5 +36,5 @@ COPY .github/docker/www.conf /usr/local/etc/php-fpm.conf
3536
COPY .github/docker/supervisord.conf /etc/supervisord.conf
3637

3738
EXPOSE 80 443
38-
ENTRYPOINT ["/bin/ash", ".github/docker/entrypoint.sh"]
39+
ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ]
3940
CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ]

0 commit comments

Comments
 (0)