-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.traefik.yml
78 lines (72 loc) · 2.06 KB
/
docker-compose.traefik.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
78
version: "3.8"
services:
# To use an built-in Postgres server, uncomment this service
#db:
# # Use regular Postgres by default
# image: postgres:15.3-bullseye
# # Use PostGIS for spatial apps
# #image: postgis/postgis:15-3.3
# env_file: .env
# volumes:
# - db_data:/var/lib/postgresql/data
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
# interval: 10s
# timeout: 5s
# retries: 5
# restart: "unless-stopped"
# networks:
# - backend
app:
image: localhost/your_app_image_here
build:
context: ./django
# To build image with extra dev tools
#dockerfile: Dockerfile.dev
command: python -m gunicorn myproject.wsgi -b 0.0.0.0:8000
env_file: .env
volumes:
- static_files:/static
- media_files:/media
- docs:/docs
# Comment this out if you're not using SQLite
- ./db:/db
restart: "unless-stopped"
# To use an built-in Postgres server, uncomment this dependency
#depends_on:
# db:
# condition: service_healthy
networks:
- backend
web:
image: mattcen/nginx_django
build: ./nginx
environment:
# Replace 'app' below with the name of the django service above
WEB_APP_HOST: app:8000
depends_on:
- app
volumes:
- static_files:/static
- media_files:/media
- docs:/docs
networks:
- backend
- proxy
restart: "unless-stopped"
labels:
traefik.enable: "true"
traefik.http.routers.replace_this_name_with_something_else.rule: Host(`your_domain_name_here.example.net`, `www.your_domain_name_here.example.net`)
traefik.http.routers.replace_this_name_with_something_else.entryPoints: websecure
traefik.http.services.replace_this_name_with_something_else.loadbalancer.server.port: 80
traefik.http.services.replace_this_name_with_something_else.loadbalancer.sticky: "true"
volumes:
db_data:
static_files:
media_files:
docs:
networks:
backend:
# The Traefik container should be on this network
proxy:
external: true