-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
57 lines (55 loc) · 1.51 KB
/
Copy pathcompose.yaml
File metadata and controls
57 lines (55 loc) · 1.51 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
services:
server:
build: .
environment:
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_NAME=example
# Enable Prometheus metrics
- ENABLE_METRICS=true
- OTEL_TRACES_EXPORTER=otlp
- OTEL_SERVICE_NAME=devops-showcase-app
- OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
ports:
- 8000:8000
# `docker compose up --watch` settings for hot reloading during development
# https://docs.docker.com/compose/how-tos/file-watch/#compose-watch-versus-bind-mounts
develop:
watch:
# Sync the working directory with the `/app` directory in the container
- action: sync
path: .
target: /app
# Exclude the project virtual environment
ignore:
- .venv/
# Rebuild the image on changes to the `pyproject.toml`
- action: rebuild
path: ./pyproject.toml
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:18-alpine
restart: always
user: postgres
volumes:
# PG18 moved PGDATA to /var/lib/postgresql/18/docker; mount the parent so data persists.
- db-data:/var/lib/postgresql
environment:
- POSTGRES_DB=example
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
expose:
- 5432
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data: