Last active
September 6, 2025 14:45
-
-
Save alisalehi1380/117113d3774c3cdee6449bc072d46b03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -d \ | |
--name phpmyadmin \ | |
--network html_default \ //notice: change network to own network | |
--restart unless-stopped \ | |
-p ${PMA_PORT:-8081}:80 \ | |
-e PMA_HOST=${DB_HOST} \ | |
-e PMA_USER=${DB_USERNAME} \ | |
-e PMA_PASSWORD=${DB_PASSWORD} \ | |
phpmyadmin/phpmyadmin:latest | |
===================================================== | |
services: | |
app: | |
container_name: app | |
environment: | |
SSL_PRIVATE_KEY_FILE: "/etc/ssl/private/privkey.pem" | |
SSL_CERTIFICATE_FILE: "/etc/ssl/private/fullchain.pem" | |
ports: | |
- "${HTTPS_PORT:-443}:8443" | |
volumes: | |
- ./docker/certs/privkey.pem:/etc/ssl/private/privkey.pem:ro | |
- ./docker/certs/fullchain.pem:/etc/ssl/private/fullchain.pem:ro | |
depends_on: | |
- certbot | |
certbot: | |
image: certbot/certbot | |
container_name: certbot | |
volumes: | |
- ./docker/certs:/etc/letsencrypt | |
- ./docker/www:/var/www/certbot | |
entrypoint: /bin/sh -c " | |
trap exit TERM; | |
while :; do | |
certbot certonly --standalone \ | |
--non-interactive --agree-tos \ | |
--email [email protected] \ | |
-d yourdomain.com -d www.yourdomain.com \ | |
--rsa-key-size 4096 --keep-until-expiring; | |
ln -sf /etc/letsencrypt/live/yourdomain.com/privkey.pem /etc/letsencrypt/privkey.pem; | |
ln -sf /etc/letsencrypt/live/yourdomain.com/fullchain.pem /etc/letsencrypt/fullchain.pem; | |
docker restart app || true; | |
sleep 12h; | |
done" | |
healthcheck: | |
test: > | |
sh -c ' | |
[ -f /etc/letsencrypt/live/yourdomain.com/fullchain.pem ] && | |
openssl x509 -checkend $((60*60*24*30)) \ | |
-noout -in /etc/letsencrypt/live/yourdomain.com/fullchain.pem | |
' | |
interval: 12h | |
timeout: 10s | |
retries: 3 | |
start_period: 30s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment