This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
103 lines (94 loc) · 2.41 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
version: "2.4"
services:
nginx:
image: nginx:1.23.4-alpine
ports:
- 2002:2002
- 80:80
- 443:443
environment:
ENVIRONMENT: ${ENVIRONMENT}
build:
context: ./nginx
dockerfile: Dockerfile
args:
ENVIRONMENT: ${ENVIRONMENT}
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- shared-images:/www/media
depends_on:
- backend
- frontend
redis:
image: redis:7.2-rc1-alpine
expose:
- 6379
volumes:
- ./redis:/data
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
database:
image: postgres:15-alpine
expose:
- 5432
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- ./data/drtrottoir:/var/lib/postgresql/data/
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U django -d drtrottoir" ]
interval: 5s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
environment:
ENVIRONMENT: ${ENVIRONMENT}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
SECRET_EMAIL_USER: ${SECRET_EMAIL_USER}
SECRET_EMAIL_USER_PSWD: ${SECRET_EMAIL_USER_PSWD}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
DJANGO_SETTINGS_MODULE: config.settings
command: [ "daphne", "config.asgi:application", "-b", "0.0.0.0", "-p", "8000" ]
expose:
- 9000
volumes:
- ./backend:/app/backend
- shared-images:/app/media
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
links:
- database
- redis
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
environment:
WATCHPACK_POLLING: "true"
command: sh -c 'if [ "${ENVIRONMENT}" = "production" ]; then npm start; else npm run dev; fi'
expose:
- 3000
volumes:
- ./frontend/pages:/app/frontend/pages
- ./frontend/components:/app/frontend/components
- ./frontend/lib:/app/frontend/lib
- ./frontend/public:/app/frontend/public
- ./frontend/styles:/app/frontend/styles
- ./frontend/locales:/app/frontend/locales
depends_on:
backend:
condition: service_started
volumes:
shared-images:
name: images