-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
61 lines (56 loc) · 2.12 KB
/
compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
server:
container_name: symfony_app
build:
context: . # construit l'image Docker à partir du Dockerfile situé dans .
ports:
- 8000:80
depends_on:
- database # démarre le service de base de données avant l'application
volumes:
- .:/var/www/html # connecte/monte le code local . dans /var/www/html du conteneur
- ./var/log:/var/www/html/var/log # récupère les logs symfony du conteneur dans son projet local
networks:
- symfony_network
database:
image: mysql:8.0
container_name: symfony_db
ports:
- "3306:3306"
env_file: ".env.local"
volumes:
- db_data:/var/lib/mysql # sauvegarde les données de la bdd dans le volume db_data (en local) même si le conteneur est arrêté ou supprimé
networks:
- symfony_network
healthcheck: # vérifie l'état de santé du conteneur
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "${MYSQL_USER}", "--password=${MYSQL_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: always # redémarre automatiquement le conteneur si celui-ci s'arrête ou plante
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: symfony_phpmyadmin
env_file: ".env.local"
environment:
PMA_HOST: database
ports:
- "8080:80"
depends_on:
- database
networks:
- symfony_network
volumes: # création des volumes nommés
db_data:
networks: # permet de connecter l'app Symfony avec la base de données MySQL
symfony_network:
driver: bridge