-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
88 lines (83 loc) · 2.89 KB
/
docker-compose.yml
File metadata and controls
88 lines (83 loc) · 2.89 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
version: '3.8'
services:
fastapi_server:
container_name: fastapi_server
build: ./fastapi-alembic-sqlmodel-async
restart: always
command: "sh -c 'alembic upgrade head && gunicorn -w 3 -k uvicorn.workers.UvicornWorker app.main:app --bind 0.0.0.0:8000 --timeout 600'"
volumes:
- ./fastapi-alembic-sqlmodel-async:/code
expose:
- "8000"
env_file: ".env"
# depends_on:
# - database
labels:
- "traefik.enable=true"
- "traefik.http.routers.fastapi_local.entrypoints=web"
- "traefik.http.routers.fastapi_local.rule=Host(`fastapi.${LOCAL_1}`, `fastapi.${LOCAL_2}`, `fastapi.${EXT_ENDPOINT1}`)"
- traefik.http.services.fastapi_localservice.loadbalancer.server.port=8000
# database:
# image: bitnami/postgresql:13.3.0
# restart: always
# container_name: database
# env_file: ".env"
# user: root
# volumes:
# - ./db_docker:/bitnami/postgresql
# ports:
# - 5454:5432 # Remove this on production
# expose:
# - 5432
# environment:
# - POSTGRES_USERNAME=${DATABASE_USER}
# - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
# - POSTGRES_DATABASE=${DATABASE_NAME}
# - POSTGRES_HOST_AUTH_METHOD= "trust"
# - POSTGRESQL_POSTGRES_PASSWORD= ${DATABASE_PASSWORD}
redis_server:
container_name: redis_server
image: "redis:alpine"
restart: always
expose:
- "6379"
env_file: .env
nginx:
container_name: nginx
restart: unless-stopped
logging:
driver: none
image: "nginx:latest"
expose:
- "8080"
volumes:
- ./static:/code/static
- ./nginx-config-files/nginx.conf:/etc/nginx/nginx.conf
- ./nginx-config-files/app.nginx.template:/etc/nginx/templates/app.nginx.template
- "${EB_LOG_BASE_DIR:-./nginx-config-files}/nginx-proxy:/var/log/nginx"
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx_local.entrypoints=web"
- "traefik.http.routers.nginx_local.rule=Host(`nginx.${LOCAL_1}`, `nginx.${LOCAL_2}`, `nginx.${EXT_ENDPOINT1}`)"
- traefik.http.services.nginx_local_service.loadbalancer.server.port=8080
traefik-proxy:
container_name: traefik-proxy
restart: always
image: "traefik:latest"
command:
- "--providers.docker=true"
ports:
- "80:80"
depends_on:
- fastapi_server
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ./traefik/traefik.yml:/traefik.yml:ro
- ./traefik/.htpasswd:/.htpasswd
- "${EB_LOG_BASE_DIR:-./traefik}/traefik-proxy:/logs"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.${LOCAL_1}`, `traefik.${LOCAL_2}`, `traefik.${EXT_ENDPOINT1}`)"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.usersfile=/.htpasswd"