Docker-compose YAML file for Wordpress, NGINX and AWS RDS. Mounts an AWS EFS volume for persistent storage. Also creates SSL certificate by running a certbot container. Just change email and domain.
version: "3.8"
services:
wordpress:
container_name: wordpress
image: wordpress:latest
restart: always
stdin_open: true
tty: true
environment:
WORDPRESS_DB_HOST: database-1.abc123456789.us-east-2.rds.amazonaws.com
WORDPRESS_DB_USER: admin
WORDPRESS_DB_PASSWORD: password123
WORDPRESS_DB_NAME: efsrds-db
volumes:
- /mnt/efs/fs1/efsrds:/var/www/html
nginx:
container_name: nginx
image: nginx:latest
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- ./nginx/conf:/etc/nginx/conf.d
- ./certbot/conf:/etc/nginx/ssl
- ./certbot/data:/var/www/html
certbot:
container_name: certbot
image: certbot/certbot:latest
command: certonly --webroot --webroot-path=/var/www/html --email myemail@gmail.com --agree-tos --no-eff-email -d askben.cloud
volumes:
- ./certbot/conf:/etc/letsencrypt
- ./certbot/logs:/var/log/letsencrypt
- ./certbot/data:/var/www/html
Reading time: 1 minute