-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
80 lines (75 loc) · 2.53 KB
/
docker-compose.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# L'argument version permet de spécifier à Docker Compose quelle version on souhaite utiliser
# et donc d'utiliser ou pas certaines versions
version: '3.8'
# L'ensemble des conteneurs qui doivent être créés doivent être définis sous l'argument services
services:
dev-db: # projet name
hostname: postgres
image: postgres:15
container_name: dev-db
restart: on-failure
ports:
- ${DATABASE_PORT}:${DATABASE_PORT}
environment: #defines environment variables set in the container
- DATABASE_URL=${DATABASE_URL}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
networks:
- transcendence-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h dev-db"]
interval: 2s
timeout: 10s
retries: 5
# volumes : permet de stocker l'ensemble du contenu du dossier /var/lib/mysql dans un disque persistant. Et donc, de pouvoir garder les données en local sur notre host.
volumes:
# On place le chemin local à gauche du séparateur : et le chemin dans le conteneur à droite
# chemin_local:chemin_conteneur
- db-data:/var/lib/postgresql/data
server:
container_name: server
build:
context: ./server
dockerfile: Dockerfile
restart: on-failure
env_file: .env
networks:
- transcendence-network
ports: # Exposes container ports. syntaxe is HOST_PORT:CONTAINER_PORT
- ${BACKEND_PORT}:${BACKEND_PORT} # api
- ${PRISMA_STUDIO_PORT}:${PRISMA_STUDIO_PORT} # prisma studio
depends_on:
dev-db:
condition: service_healthy
volumes:
- ./server:/app
command: ["npm", "run", "start:dev"]
# the command field is used to override the default command that is executed
# when starting a container based on the specified Docker image. it sets a new command
# and its arguments that will be executed within the container.
client:
container_name: client
build:
context: ./client
dockerfile: Dockerfile
restart: on-failure
env_file: .env
networks:
- transcendence-network
ports:
- ${FRONTEND_PORT}:${FRONTEND_PORT}
depends_on:
- dev-db
- server
volumes:
- ./client:/app
command: ["npm", "run", "start"]
volumes:
db-data:
name: "db-data"
# networks defines the networks that service containers are attached to,
# referencing entries under the top-level networks key.
networks:
transcendence-network:
driver: bridge