-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
43 lines (40 loc) · 1.04 KB
/
docker-compose.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
services:
todo:
build: .
image: todo
ports:
- "5000"
environment: # Add environment variables
- DATABASE_URL=postgresql+psycopg2://postgres:postgres@todo-db:5432/postgres
labels:
# Explicitly tell Traefik to expose this container
- "traefik.enable=true"
# The domain the service will respond to
- "traefik.http.routers.todo.rule=Host(`localhost`)"
depends_on:
- todo-db
- traefik
todo-db:
image: postgres:14
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
volumes: # Mount host paths or named volumes
- pgdata:/var/lib/postgresql/data
traefik:
image: traefik:v3.0
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
pgdata: