forked from fastapi/full-stack-fastapi-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
180 lines (164 loc) · 5.01 KB
/
docker-compose.yml
File metadata and controls
180 lines (164 loc) · 5.01 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# docker-compose.yml
services:
db:
image: postgres:17
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
adminer:
image: adminer
restart: always
networks:
- traefik-public
- default
depends_on:
- db
environment:
- ADMINER_DESIGN=pepa-linha-dark
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.routers.full-stack-fastapi-template-adminer-http.rule=Host(`adminer.localhost`)
- traefik.http.routers.full-stack-fastapi-template-adminer-http.entrypoints=http
- traefik.http.services.full-stack-fastapi-template-adminer.loadbalancer.server.port=8080
prestart:
image: backend:latest
build:
context: ./backend
networks:
- traefik-public
- default
depends_on:
db:
condition: service_healthy
command: bash scripts/prestart.sh
env_file:
- .env
environment:
- DOMAIN=localhost
- FRONTEND_HOST=http://localhost:5173
- ENVIRONMENT=local
- BACKEND_CORS_ORIGINS=["http://localhost:5173"]
- SECRET_KEY=${SECRET_KEY}
- FIRST_SUPERUSER=${FIRST_SUPERUSER}
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- EMAILS_FROM_EMAIL=${EMAILS_FROM_EMAIL}
- POSTGRES_SERVER=db
- POSTGRES_PORT=5432
- POSTGRES_DB=app
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- SENTRY_DSN=${SENTRY_DSN}
backend:
image: backend:latest
restart: always
networks:
- traefik-public
- default
depends_on:
db:
condition: service_healthy
prestart:
condition: service_completed_successfully
env_file:
- .env
environment:
- DOMAIN=localhost
- FRONTEND_HOST=http://localhost:5173
- ENVIRONMENT=local
- BACKEND_CORS_ORIGINS=["http://localhost:5173"]
- SECRET_KEY=${SECRET_KEY}
- FIRST_SUPERUSER=${FIRST_SUPERUSER}
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- EMAILS_FROM_EMAIL=${EMAILS_FROM_EMAIL}
- POSTGRES_SERVER=db
- POSTGRES_PORT=5432
- POSTGRES_DB=app
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- SENTRY_DSN=${SENTRY_DSN}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/health-check/"]
interval: 10s
timeout: 5s
retries: 5
build:
context: ./backend
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.services.full-stack-fastapi-template-backend.loadbalancer.server.port=8000
- traefik.http.routers.full-stack-fastapi-template-backend-http.rule=Host(`api.localhost`)
- traefik.http.routers.full-stack-fastapi-template-backend-http.entrypoints=http
frontend:
image: frontend:latest
restart: always
networks:
- traefik-public
- default
build:
context: ./frontend
args:
- VITE_API_URL=http://api.localhost
- NODE_ENV=local
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.services.full-stack-fastapi-template-frontend.loadbalancer.server.port=80
- traefik.http.routers.full-stack-fastapi-template-frontend-http.rule=Host(`dashboard.localhost`)
- traefik.http.routers.full-stack-fastapi-template-frontend-http.entrypoints=http
mailcatcher:
image: schickling/mailcatcher
restart: always
networks:
- traefik-public
- default
ports:
- "1025:1025"
- "1080:1080"
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.routers.full-stack-fastapi-template-mailcatcher-http.rule=Host(`mailcatcher.localhost`)
- traefik.http.routers.full-stack-fastapi-template-mailcatcher-http.entrypoints=http
- traefik.http.services.full-stack-fastapi-template-mailcatcher.loadbalancer.server.port=1080
proxy:
image: traefik:3.0
restart: always
command:
- --providers.docker
- --providers.docker.exposedbydefault=false
- --entrypoints.http.address=:80
- --api.dashboard=true
networks:
- traefik-public
ports:
- "80:80"
- "8090:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
app-db-data:
networks:
traefik-public:
external: false