Skip to content

Instantly share code, notes, and snippets.

View gauraputu's full-sized avatar

gaura gauraputu

View GitHub Profile
@gauraputu
gauraputu / nginx-certbot.docker
Created May 21, 2025 05:19 — forked from 5lx/nginx-certbot.docker
Alpine Nginx with auto renew letsencrypt certbot Dockerfile
FROM nginx:alpine
EXPOSE 80 443
VOLUME ["/etc/nginx/conf.d/", "/var/www/html", "/etc/letsencrypt"]
RUN apk add --no-cache certbot \
&& echo "0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew --post-hook \"nginx -s reload\"" > /etc/crontabs/root
CMD ["/bin/sh", "-c", "crond -b && certbot renew && nginx -g 'daemon off;'"]