forked from mtusi2026/mtusi2026lab2
feat: complete lab2 with postgres, auth, migrations, and persistence
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: lab2_postgres
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: messenger_db
|
||||
ports:
|
||||
- "5433:5432" # Пробрасываем на 5433, чтобы не конфликтовать с локальным Mac PG
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d messenger_db"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
app:
|
||||
build: .
|
||||
container_name: lab2_app
|
||||
environment:
|
||||
# Внутри Docker сеть имя сервиса 'db' резолвится в IP контейнера базы, порт 5432
|
||||
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/messenger_db
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
Reference in New Issue
Block a user