forked from amerkurev/django-docker-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
77 lines (73 loc) · 2.16 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
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
restart: unless-stopped
volumes:
- "staticfiles-data:/var/www/static"
- "media-data:/var/www/media"
depends_on:
- postgres
labels:
- "traefik.enable=true"
- "traefik.http.routers.development.rule=Host(`127.0.0.1`) || Host(`localhost`)"
- "traefik.http.routers.development.entrypoints=web"
- "traefik.http.routers.development.priority=1"
nginx:
image: nginx:1.23-alpine
env_file: .env
restart: unless-stopped
volumes:
- type: volume
source: media-data
target: /usr/share/nginx/html/media
read_only: true
volume:
nocopy: true
- type: volume
source: staticfiles-data
target: /usr/share/nginx/html/static
read_only: true
volume:
nocopy: true
depends_on:
- django
labels:
- "traefik.enable=true"
- "traefik.http.routers.staticfiles.rule=PathPrefix(`/static/`) || PathPrefix(`/media/`)"
- "traefik.http.routers.staticfiles.entrypoints=web"
- "traefik.http.routers.staticfiles.priority=2"
reverse-proxy:
image: traefik:v2.9
env_file: .env
restart: unless-stopped
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.le-resolver.acme.httpchallenge=true"
- "--certificatesresolvers.le-resolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.le-resolver.acme.email=admin@yourdomain.com"
- "--certificatesresolvers.le-resolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
#- "8080:8080"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
postgres-data:
staticfiles-data:
media-data: