-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
68 lines (60 loc) · 1.59 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
---
# Default compose file for development and production.
# Should be used directly in development.
# Automatically loads `docker-compose.override.yml` if it exists.
# No extra steps required.
# Should be used together with `docker/docker-compose.prod.yml`
# in production.
version: "3.8"
services:
db:
image: "postgres:13-alpine"
restart: unless-stopped
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- webnet
env_file: .env
web:
<<: &web
# Image name is changed in production:
image: "django-better-json-widget:dev"
build:
target: development
context: .
cache_from:
- "django-better-json-widget:dev"
- "django-better-json-widget:latest"
- "*"
volumes:
- django-static:/var/www/django/static
depends_on:
- db
networks:
- webnet
env_file: .env
environment:
DJANGO_DATABASE_HOST: db
healthcheck:
# We use `$$` here because:
# one `$` goes to shell,
# one `$` goes to `docker-compose.yml` escaping
test: |
/usr/bin/test $$(
/usr/bin/curl --fail http://localhost:8000/health/?format=json
--write-out "%{http_code}" --silent --output /dev/null
) -eq 200
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# This task is an example of how to extend existing ones:
# some_worker:
# <<: *web
# command: python manage.py worker_process
networks:
# Network for your internals, use it by default:
webnet:
volumes:
pgdata:
django-static: