-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
75 lines (67 loc) · 1.89 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
---
# 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:16-alpine"
restart: unless-stopped
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- postgresnet
env_file: ./config/.env
web:
<<: &web
# Image name is changed in production:
image: "shopkg:dev"
build:
target: development_build
context: .
dockerfile: ./docker/django/Dockerfile
args:
DJANGO_ENV: development
cache_from:
- "shopkg:dev"
- "shopkg:latest"
- "*"
volumes:
- django-static:/var/www/django/static
depends_on:
- db
networks:
- webnet
- postgresnet
env_file: ./config/.env
environment:
DJANGO_DATABASE_HOST: db
command: python -Wd manage.py runserver 0.0.0.0:8000
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 postgres, use it for services that need access to the db:
postgresnet:
# Network for your internals, use it by default:
webnet:
volumes:
pgdata:
django-static: