forked from amerkurev/django-docker-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.caddy.yml
58 lines (55 loc) · 1.3 KB
/
docker-compose.caddy.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
version: "3.9"
services:
postgres:
image: postgres:15
env_file: .env
restart: unless-stopped
volumes:
- "postgres-data:/var/lib/postgresql/data/"
django:
build: .
image: django-docker
env_file: .env
environment:
- "DJANGO_ALLOWED_HOSTS=${MY_DOMAIN}"
- "DJANGO_CSRF_TRUSTED_ORIGINS=https://${MY_DOMAIN}"
- "DJANGO_SESSION_COOKIE_SECURE=true"
- "DJANGO_CSRF_COOKIE_SECURE=true"
- "DJANGO_SECURE_SSL_REDIRECT=true"
restart: unless-stopped
volumes:
- "staticfiles-data:/var/www/static"
- "media-data:/var/www/media"
depends_on:
- postgres
caddy:
image: caddy:2.7-alpine
env_file: .env
environment:
- "MY_DOMAIN=${MY_DOMAIN}"
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- "./Caddyfile:/etc/caddy/Caddyfile:ro"
- "caddy-data:/data"
- "caddy-config:/config"
- type: volume
source: media-data
target: /usr/share/caddy/media
read_only: true
volume:
nocopy: true
- type: volume
source: staticfiles-data
target: /usr/share/caddy/static
read_only: true
volume:
nocopy: true
volumes:
caddy-data:
caddy-config:
media-data:
postgres-data:
staticfiles-data: