138 lines
3.2 KiB
YAML
138 lines
3.2 KiB
YAML
networks:
|
|
inception:
|
|
name: inception
|
|
|
|
volumes:
|
|
db_data:
|
|
name: db_data
|
|
driver: local
|
|
driver_opts:
|
|
type: 'none'
|
|
o: 'bind'
|
|
device: '/data/db_data'
|
|
site_data:
|
|
name: site_data
|
|
driver: local
|
|
driver_opts:
|
|
type: 'none'
|
|
o: 'bind'
|
|
device: '/data/site_data'
|
|
|
|
services:
|
|
|
|
mariadb :
|
|
container_name : mariadb
|
|
image: mariadb:latest
|
|
networks :
|
|
- inception
|
|
restart: always
|
|
volumes :
|
|
- db_data:/var/lib/mysql
|
|
env_file:
|
|
- .env
|
|
environment :
|
|
- MARIADB_DATABASE=wp-db
|
|
- MARIADB_USER=${MARIADB_USER:-wp}
|
|
- MARIADB_PASSWORD=${MARIADB_PASSWORD:-password123}
|
|
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-rootpassword}
|
|
|
|
phpmyadmin:
|
|
image: phpmyadmin
|
|
restart: always
|
|
ports:
|
|
- 8080:80
|
|
environment:
|
|
- PMA_ARBITRARY=1
|
|
- PMA_HOST=mariadb
|
|
- PMA_USER=${MARIADB_USER:-wp}
|
|
- PMA_PASSWORD=${MARIADB_ROOT_PASSWORD:-rootpassword}
|
|
depends_on:
|
|
- mariadb
|
|
|
|
wordpress :
|
|
container_name: wordpress
|
|
image: wordpress:latest
|
|
networks :
|
|
- inception
|
|
depends_on :
|
|
- mariadb
|
|
restart: always
|
|
volumes :
|
|
- site_data:/var/www/html
|
|
env_file:
|
|
- .env
|
|
environment :
|
|
- WORDPRESS_DB_HOST=mariadb
|
|
- WORDPRESS_DB_USER=${MARIADB_USER:-wp}
|
|
- WORDPRESS_DB_PASSWORD=${MARIADB_PASSWORD:-password123}
|
|
- WORDPRESS_DB_NAME=wp-db
|
|
|
|
wp-cli:
|
|
container_name: wp-cli
|
|
image: wordpress:cli
|
|
networks :
|
|
- inception
|
|
env_file:
|
|
- .env
|
|
environment :
|
|
- WORDPRESS_DB_HOST=mariadb
|
|
- WORDPRESS_DB_USER=${MARIADB_USER:-wp}
|
|
- WORDPRESS_DB_PASSWORD=${MARIADB_PASSWORD:-password123}
|
|
- WORDPRESS_DB_NAME=wp-db
|
|
volumes:
|
|
- site_data:/var/www/html
|
|
depends_on:
|
|
- wordpress
|
|
- mariadb
|
|
working_dir: /var/www/html
|
|
command: >
|
|
/bin/sh -c '
|
|
sleep 10;
|
|
|
|
until wp core install \
|
|
--url=https://$APP_DOMAIN \
|
|
--title="Le Noctambule" \
|
|
--admin_name=$WP_ADMIN \
|
|
--admin_password=$WP_ADMIN_PWD \
|
|
--admin_email=$WP_ADMIN_EMAIL
|
|
do
|
|
echo "Waiting for WordPress to be ready...";
|
|
sleep 5;
|
|
done;
|
|
|
|
until wp user create \
|
|
$WP_USER $WP_EMAIL \
|
|
--user_pass=$WP_PWD \
|
|
--role=author
|
|
do
|
|
echo "Retrying user creation...";
|
|
sleep 5;
|
|
done;
|
|
'
|
|
nginx:
|
|
container_name: nginx
|
|
image: nginx:latest
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
networks :
|
|
- inception
|
|
ports:
|
|
- 80:80
|
|
- 443:443
|
|
depends_on:
|
|
- wordpress
|
|
volumes:
|
|
- site_data:/var/www/wordpress
|
|
- ./nginx/secure/:/etc/nginx/templates/
|
|
- /etc/localtime:/etc/localtime:ro
|
|
- ./nginx/certbot/conf:/etc/letsencrypt
|
|
- ./nginx/certbot/www:/var/www/certbot
|
|
- ./nginx/99-autoreload.sh:/docker-entrypoint.d/99-autoreload.sh
|
|
|
|
certbot:
|
|
image: certbot/certbot
|
|
volumes:
|
|
- ./nginx/certbot/conf:/etc/letsencrypt
|
|
- ./nginx/certbot/www:/var/www/certbot
|
|
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" |