-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yaml
80 lines (75 loc) · 2.58 KB
/
docker-compose.prod.yaml
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
version: "3.8"
# For local development, only database is running
#
# docker-compose up -d
# uvicorn app.main:app --reload
#
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.10
# Enables the web UI and tells Traefik to listen to docker
command:
- "--log.level=DEBUG"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
# - "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.letsencrypt.acme.email=colaboai@gmail.com"
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
# Redirects all HTTP traffic to HTTPS
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.websecure.http.redirections.entrypoint.scheme=https"
ports:
# The HTTP port
- "80:80"
# The HTTPS port
- "443:443"
volumes:
# Certificates will be stored in this volume
- "./traefik-public-certificates:/letsencrypt"
# So that Traefik can listen to the Docker events
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
- backend
labels:
- "traefik.enable=true"
- "traefik.docker.network=backend"
- "traefik.http.routers.dashboard.rule=Host(`dashboard-api-dev.wegogym.kr`) && (PathPrefix(`/`))"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.dashboard.service=api@internal"
fastapi:
build:
context: .
dockerfile: docker/api/Dockerfile.prod
args:
USER_ID: $USER_ID
GROUP_ID: $GROUP_ID
USER_NAME: "$API_CONTAINER_USER_NAME"
ostype: "Linux"
volumes:
- ./:/home
env_file:
- .env.prod
tty: true
expose:
- "8000:8000"
networks:
- backend
labels:
- "traefik.enable=true"
- "traefik.docker.network=backend"
- "traefik.http.routers.fastapi.rule=Host(`api-dev.wegogym.kr`)"
- "traefik.http.routers.fastapi.tls=true"
- "traefik.http.routers.fastapi.tls.certresolver=letsencrypt"
- "traefik.http.services.fastapi.loadbalancer.server.port=8000"
networks:
backend:
driver: "bridge"
volumes:
traefik-public-certificates: