70 lines
1.6 KiB
YAML
70 lines
1.6 KiB
YAML
name: messenger
|
|
|
|
services:
|
|
postgres:
|
|
image: docker.io/library/postgres:18.6-alpine3.24
|
|
environment:
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
secrets:
|
|
- postgres_password
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql
|
|
ports:
|
|
- "127.0.0.1:55432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
|
interval: 2s
|
|
timeout: 3s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: docker.io/library/redis:8.10.3-alpine3.23
|
|
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
|
|
volumes:
|
|
- redisdata:/data
|
|
ports:
|
|
- "127.0.0.1:56379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 2s
|
|
timeout: 3s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
|
|
api:
|
|
build: .
|
|
image: localhost/messenger-api:lab2
|
|
environment:
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8080"
|
|
APP_ENV: ${APP_ENV:-lab}
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
DATABASE_URL_FILE: /run/secrets/database_url
|
|
CACHE_URL_FILE: /run/secrets/cache_url
|
|
secrets:
|
|
- database_url
|
|
- cache_url
|
|
ports:
|
|
- "8080:8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
secrets:
|
|
postgres_password:
|
|
file: ./secrets/postgres_password
|
|
database_url:
|
|
file: ./secrets/database_url
|
|
cache_url:
|
|
file: ./secrets/cache_url
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|