I’ve followed this tutorial to obtain the certificate (sudo certbot certonly --nginx):
Docker-compose file:
nginx:
restart: always
hostname: reverse
image: nginx
#depends_on:
#- vue
networks: ['rasa-network']
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
ports:
- "80:808"
- "443:4438"
volumes:
- ./nginx/conf/conf.d:/etc/nginx/conf.d
- ./nginx/conf/partials:/etc/nginx/partials
- ./nginx/certbot/conf:/etc/letsencrypt
- ./nginx/certbot/www:/var/www/certbot
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
certbot:
image: certbot/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
- ./nginx/certbot/conf:/etc/letsencrypt
- ./nginx/certbot/www:/var/www/certbot