-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
106 lines (103 loc) · 3.38 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
version: "3.9"
services:
tech_db:
container_name: tech_db
image: postgres:15.1
ports:
- 5432:5432
environment:
POSTGRES_USER: tech_user
POSTGRES_PASSWORD: tech_password
POSTGRES_DB: tech_db
volumes:
- postgres-data:/var/lib/postgresql/data
- ./scripts/dump.sql:/docker-entrypoint-initdb.d/init_db.sql
server:
build: .
container_name: server
depends_on:
- tech_db
profiles:
- app
restart: unless-stopped
volumes:
- ./server:/home/app/server:ro
# Override the command to watch for file changes in development.
command: ["./.local/bin/uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
ports:
- "8000"
environment:
DB_HOST: tech_db
DB_PORT: 5432
DB_USERNAME: tech_user
DB_PASSWORD: tech_password
DB_DATABASE: tech_db
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.server-strip-prefix.stripprefix.prefixes=/api"
- "traefik.http.middlewares.server-strip-prefix.stripprefix.forceSlash=false"
# HTTP
- "traefik.http.routers.server.rule=PathPrefix(`/api`)"
- "traefik.http.routers.server.entrypoints=web"
- "traefik.http.routers.server.middlewares=server-strip-prefix@docker"
# HTTPS
- "traefik.http.routers.server-secure.rule=PathPrefix(`/api`)"
- "traefik.http.routers.server-secure.entrypoints=web-secure"
- "traefik.http.routers.server-secure.tls=true"
- "traefik.http.routers.server-secure.middlewares=server-strip-prefix@docker"
client:
container_name: client
build: ./client
depends_on:
- server
profiles:
- app
expose:
- "3000"
labels:
- "traefik.enable=true"
# HTTP
- "traefik.http.routers.client.rule=PathPrefix(`/client`)"
- "traefik.http.routers.client.entrypoints=web"
# HTTPS
- "traefik.http.routers.client-secure.rule=PathPrefix(`/client`)"
- "traefik.http.routers.client-secure.entrypoints=web-secure"
- "traefik.http.routers.client-secure.tls=true"
volumes:
- ./client/dist/assets:/opt/app/assets:ro
# Add a bind mount with the source code.
- ./client/src:/opt/app/src:ro
# Add a bind mount with the public directory.
- ./client/public:/opt/app/public:ro
# Add a bind mount with index.html.
- ./client/index.html:/opt/app/index.html:ro
# Add a bind mount with the vite config.
- ./client/vite.config.js:/opt/app/vite.config.js:ro
reverse-proxy:
container_name: reverse-proxy
image: traefik:2.9
profiles:
- app
command:
- "--log.level=DEBUG"
- "--api.dashboard=true"
- "--entrypoints.web.address=:8000"
- "--entrypoints.web-secure.address=:8443"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--api.insecure=true"
- "--providers.file.directory=/configuration"
- "--providers.file.watch=true"
ports:
- "8080:8080"
- "8000:8000"
- "8443:8443"
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./development-certs/localhost.crt:/etc/certs/localhost.crt:ro
- ./development-certs/localhost.key:/etc/certs/localhost.key:ro
- ./traefik/development-dynamic-config.yml:/configuration/dynamic.yml:ro
volumes:
postgres-data:
external: true