-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
86 lines (78 loc) · 1.7 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
services:
django-init-static:
build:
context: .
target: django
command:
- python
- manage.py
- collectstatic
- --no-input
environment:
STATIC_ROOT: '/static'
DJANGO_SETTINGS_MODULE: django_demo.build_static_settings
volumes:
- static:/static
user: root
django-static:
image: docker.io/bitnami/nginx:1.25
volumes:
- static:/app/:ro
depends_on:
django-init-static:
condition: service_completed_successfully
ports:
- "127.0.0.1:8001:8080"
postgresql:
image: docker.io/bitnami/postgresql:16.2.0
environment:
POSTGRESQL_PASSWORD_FILE: /run/secrets/postgresql
healthcheck:
test: ["CMD", "pg_isready", "-U", "django-demo", "-d", "dbname=django-demo"]
start_period: 10s
interval: 10s
timeout: 2s
retries: 3
secrets:
- postgresql
env_file:
- .env.postgresql
django-demo-init:
build:
context: .
target: django
command: python manage.py migrate
restart: on-failure
depends_on:
postgresql:
condition: service_healthy
secrets:
- postgresql
- django-key
env_file:
- .env.postgresql
- .env.django
django-demo:
build:
context: .
restart: on-failure
depends_on:
django-demo-init:
condition: service_completed_successfully
postgresql:
condition: service_healthy
env_file:
- .env.postgresql
- .env.django
secrets:
- postgresql
- django-key
ports:
- "127.0.0.1:8000:8000"
secrets:
postgresql:
file: .secret/postgresql.txt
django-key:
file: .secret/django-key.txt
volumes:
static: {}