-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
49 lines (48 loc) · 1.62 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
49 lines (48 loc) · 1.62 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
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile.prod
expose:
- 80
environment:
- DATABASE_URL=postgresql://fastapi_traefik_prod:fastapi_traefik_prod@db:5432/fastapi_traefik_prod
depends_on:
- db
labels:
- "traefik.enable=true"
- "traefik.http.routers.fastapi.rule=Host(`fastapi-traefik.ec2-18-118-123-93.us-east-2.compute.amazonaws.com`)"
- "traefik.http.routers.fastapi.tls=true"
- "traefik.http.routers.fastapi.tls.certresolver=letsencrypt"
db:
image: postgres:15-alpine
volumes:
- postgres_data_prod:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=fastapi_traefik_prod
- POSTGRES_PASSWORD=fastapi_traefik_prod
- POSTGRES_DB=fastapi_traefik_prod
traefik:
build:
context: .
dockerfile: Dockerfile.traefik
ports:
- 80:80
- 443:443
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik-public-certificates:/certificates"
labels:
- "traefik.enalbe=true"
- "traefik.http.routers.dashboard.rule=Host(`dashboard-fastapi-traefik.ec2-18-118-123-93.us-east-2.compute.amazonaws.com`) && (PathPrefix(`/`))"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=testuser:$$apr1$$izolST.K$$frvZDGHNBFRuvI8tCPc3/0"
volumes:
postgres_data_prod:
traefik-public-certificates: