-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-prod.yml
45 lines (41 loc) · 1.02 KB
/
docker-compose-prod.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
version: '3.8'
networks:
web:
external: true
internal:
external: false
services:
blog:
build: ./src
command: |
bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8000'
volumes:
- ./src/:/usr/src/app/
ports:
- 8000:8000
environment:
- DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@db/${DB_NAME}
labels:
- traefik.enable=true
- traefik.http.routers.blog.rule=Host(`blog.blakesenftner.com`, `www.blakesenftner.com`)
- traefik.http.routers.blog.tls=true
- traefik.http.routers.blog.tls.certresolver=lets-encrypt
networks:
- internal
- web
db:
image: postgres:13-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
networks:
- internal
labels:
- traefik.enable=false
volumes:
postgres_data: