Files
docker-php-stack/docker-compose.yml
T

70 lines
2.1 KiB
YAML

networks:
frontend:
external: true
name: frontend
backend:
services:
# Configuration de la base de données avec MariaDB
database:
restart: unless-stopped
container_name: ${CONTAINER_PREFIX}_database
image: ${DATABASE_IMAGE}
volumes:
# Données
- ./host/database/data:/var/lib/mysql
- ./host/database/sql:/sql
- ./host/database/backups:/backups
# Configuration
- ./host/database/conf/my.cnf:/etc/mysql/mariadb.conf.d/my.cnf
environment:
MARIADB_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
networks:
- backend
# Configuration d'Apache et de PHP
apache-php:
restart: unless-stopped
container_name: ${CONTAINER_PREFIX}_apache_php
image: ${APACHE_PHP_VERSION}
environment:
- APACHE_ADMIN_EMAIL=${APACHE_ADMIN_EMAIL}
volumes:
- ./www:/var/www/html
- ./host/apache/logs:/var/log/apache2
- ./host/apache/conf/vhost.conf:/etc/apache2/sites-available/000-default.conf
- ./host/apache/conf/apache2.conf:/etc/apache2/conf-enabled/docker.conf
depends_on:
- database
labels:
- traefik.enable=true
- traefik.docker.network=frontend
- traefik.http.routers.${CONTAINER_PREFIX}_apache_php.rule=Host(`${PROJECT_URL}`)
- traefik.http.routers.${CONTAINER_PREFIX}_apache_php.entrypoints=web
- traefik.http.routers.${CONTAINER_PREFIX}_apache_php.entrypoints=websecure
- traefik.http.routers.${CONTAINER_PREFIX}_apache_php.tls=true
networks:
- frontend
- backend
# Configuration de PHPMyAdmin
phpmyadmin:
restart: unless-stopped
container_name: ${CONTAINER_PREFIX}_pma
image: ${PHPMYADMIN_IMAGE}
depends_on:
- database
labels:
- traefik.enable=true
- traefik.docker.network=frontend
- traefik.http.routers.${CONTAINER_PREFIX}_pma.rule=Host(`${PHPMYADMIN_URL}`)
- traefik.http.routers.${CONTAINER_PREFIX}_pma.entrypoints=web
- traefik.http.routers.${CONTAINER_PREFIX}_pma.entrypoints=websecure
- traefik.http.routers.${CONTAINER_PREFIX}_pma.tls=true
environment:
- PMA_HOST=database
networks:
- frontend
- backend