-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
78 lines (77 loc) · 2.46 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
services:
redis:
image: "redis:7"
networks:
- transcendence_network
postgres:
image: "postgres:16"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
volumes:
- ${POSTGRES_DATA}:/var/lib/postgresql/data
networks:
- transcendence_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d postgres -p 5432"]
interval: 1s
timeout: 15s
retries: 5
start_period: 10s
django:
build: ./src/backend/django
# mind that manage.py is in the tr_django folder
command: sh -c "echo Error the command of django must be overwritten"
env_file:
- ./.env
# volumes:
# volumes must be defined in override (dev) and production(prod) file
depends_on:
redis:
condition: service_started
postgres:
condition: service_healthy
environment:
- REDIS_URL=${REDIS_URL}
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- SECRET_KEY=${SECRET_KEY}
- ENVIRONMENT=production
- DATABASE_URL=${DATABASE_URL}
# postgres is the value of the service name in the docker compose file
# it means it will work only if postgres service is up and running
# and it will not work with a postgres running on the host machine
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
networks:
- transcendence_network
stop_grace_period: 1s # SIGKILL after 1s
nginx:
build:
# we need the context to be ./src instad of ./src/nginx to so that it can see easily the frontend folder
context: ./src/
dockerfile: nginx/Dockerfile
args:
ENVIRONMENT: ${ENVIRONMENT} # Pass the environment as a build argument
volumes:
- ./src/frontend/:/usr/share/nginx/html
- ./src/nginx/logs:/var/log/nginx
- ./media:/var/www/media
- ./ssl-keys:/etc/letsencrypt/live/.000031.xyz:ro
# ports:
# due to the way multiple docker compose files are
# merged (e.g. using docker-compose.override.yml) the
# ports are defined in the more concrete dev/prod files
environment:
- ENVIRONMENT=production
# - NGINX_ENTRYPOINT_QUIET_LOGS=0 # to enable more verbose logging
depends_on:
- django
networks:
- transcendence_network
command: ["nginx", "-g", "daemon off;"]
networks:
transcendence_network:
driver: bridge