Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created January 30, 2020 15:48
Show Gist options
  • Save peteristhegreat/22d7dbae4dc9a75e718d83f896de1234 to your computer and use it in GitHub Desktop.
Save peteristhegreat/22d7dbae4dc9a75e718d83f896de1234 to your computer and use it in GitHub Desktop.
Docker with certbot or letsencrypt

Cerbot with nginx

https://medium.com/@vshab/nginx-with-lets-encrypt-in-docker-container-e549d18c00d7 https://github.com/vshab/nginx-with-lets-encrypt-in-docker-example

Certbot with Debian (other)

https://certbot.eff.org/lets-encrypt/debianbuster-other

Certbot's dockerfile

https://hub.docker.com/r/certbot/certbot/

Cerbot in a docker-compose setup

https://github.com/andyneff/docker-letsencrypt

My crazy script

#!/usr/bin/env bash

docker build -t flask-server .

echo "Starting certbot..."
time docker run -p 80:80 -u 0 --entrypoint "/usr/bin/certbot" flask-license-server certonly --standalone -d example.com --email [email protected] -n --agree-tos --expand
sudo docker commit $(docker ps -lq) flask-server
echo "Done with certbot and commiting changes to the docker file."
sleep 2
echo "Starting the server docker image..."
docker run --env-file .env -p 443:443 -p 80:80 -u 0 --entrypoint "python" -dit flask-server server.py

echo "Launching cron"
docker exec -it $(docker ps -lq) cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment