Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
51 lines (48 loc) · 1.48 KB
/
Copy pathcompose.yaml
File metadata and controls
51 lines (48 loc) · 1.48 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
---
services:
fastapi:
build:
context: .
dockerfile: ./Dockerfile
pull_policy: build
image: fastapi
container_name: fastapi
ports:
- 8080:8080
environment:
# Inside the container the database is reached over the Docker
# network by service name, NOT localhost (localhost would be the
# container itself and connection is refused). Values are read from
# the host .env if set, otherwise sensible dev defaults apply.
DB_URL: postgresql://postgres:1234@fastapi-postgres:5432/postgres
AUTH_SECRET_KEY: ${AUTH_SECRET_KEY:-dev-secret-change-me}
ENVIRONMENT: ${ENVIRONMENT:-development}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
LOG_FORMAT: ${LOG_FORMAT:-console}
CORS_ORIGINS: ${CORS_ORIGINS:-}
volumes:
- ./src:/code/src
networks:
- fastapi-network
depends_on:
- postgres
postgres:
image: postgres:16.2-alpine
container_name: fastapi-postgres
ports:
- 5432:5432
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=1234
volumes:
- db:/var/lib/postgresql/data
networks:
- fastapi-network
networks:
fastapi-network:
driver: bridge
name: fastapi-network
volumes:
db:
driver: local