-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (74 loc) · 2.21 KB
/
docker-compose.yml
File metadata and controls
82 lines (74 loc) · 2.21 KB
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
version: "3.9"
services:
nginx:
image: nginx:latest
container_name: nginx_contrast_api
ports:
- "8080:8080"
volumes:
- ./nginx_compose:/etc/nginx/conf.d
- ./data/static:/static
- ./data/media:/media
depends_on:
web:
condition: service_healthy
db:
image: postgres:13
container_name: postgres_contrast_api
environment:
- POSTGRES_DB=contrast_api_db #todo
- POSTGRES_USER=contrast_api_user
- POSTGRES_PASSWORD=contrast_api_pass
ports:
- "5433:5432"
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U contrast_api_user -d contrast_api_db -p 5432" ]
interval: 10s
timeout: 5s
retries: 5
web:
container_name: web_contrast_api
build:
context: .
dockerfile: deploy/Dockerfile
environment:
- DJANGO_ALLOWED_HOSTS=web,localhost,127.0.0.1
- PYTHONBUFFERED=1
- DJANGO_CONFIGURATION=Development
- DJANGO_MEDIA_ROOT=/media/
- DJANGO_SETTINGS_MODULE=contrast_api.settings
- DATABASE_URL=postgresql://contrast_api_user:contrast_api_pass@db/contrast_api_db
command:
- bash
- -c
- |
python manage.py migrate
python manage.py createsuperuser --username admin --email admin@admin.com --noinput && cat <<-000 | python manage.py shell
from django.contrib.auth import get_user_model
admin = get_user_model().objects.get(username='admin')
admin.set_password('admin')
admin.save()
print('Superuser password updated successfully.')
000
python manage.py collectstatic --noinput
cp /srv/app/static/* -r /static/
gunicorn contrast_api.wsgi --timeout 180 --bind 0.0.0.0 --reload
volumes:
- ./data/static:/static
- ./data/media:/media
- .:/srv/app
restart: on-failure
expose:
- "8000"
depends_on:
db:
condition: service_healthy
healthcheck:
# test: ["CMD-SHELL", "curl", "http://web:8000/health_check || exit 1"]
test: ["CMD-SHELL", "exit 0"] # overriding an issue for now
start_period: 5s
interval: 10s
timeout: 5s
retries: 5