94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
services:
|
|
app:
|
|
image: ${GIT_HOST}/${GIT_USER}/${GIT_REPO}:app
|
|
restart: unless-stopped
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 10
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
PROJECT_NAME: ${PROJECT_NAME}
|
|
VERSION: ${VERSION}
|
|
API_V1_PREFIX: ${API_V1_PREFIX}
|
|
DB_HOST: postgres
|
|
DB_PORT: ${DB_PORT}
|
|
DB_NAME: ${DB_NAME}
|
|
DB_USER: ${DB_USER}
|
|
DB_PASSWORD: ${DB_PASSWORD}
|
|
SQLALCHEMY_ECHO: ${SQLALCHEMY_ECHO}
|
|
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
|
|
JWT_ALGORITHM: ${JWT_ALGORITHM}
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: ${ACCESS_TOKEN_EXPIRE_MINUTES}
|
|
REFRESH_TOKEN_EXPIRE_DAYS: ${REFRESH_TOKEN_EXPIRE_DAYS}
|
|
REDIS_ENABLED: ${REDIS_ENABLED}
|
|
REDIS_URL: redis://redis:6379/0
|
|
ANALYTICS_CACHE_TTL_SECONDS: ${ANALYTICS_CACHE_TTL_SECONDS}
|
|
ANALYTICS_CACHE_BACKOFF_MS: ${ANALYTICS_CACHE_BACKOFF_MS}
|
|
ports:
|
|
- "80:8000"
|
|
volumes:
|
|
- ./frontend/dist:/opt/app/frontend/dist:ro
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
depends_on:
|
|
postgres:
|
|
condition: service_started
|
|
redis:
|
|
condition: service_started
|
|
migrations:
|
|
condition: service_completed_successfully
|
|
|
|
migrations:
|
|
image: ${GIT_HOST}/${GIT_USER}/${GIT_REPO}:migrations
|
|
restart: "no"
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DB_HOST: postgres
|
|
REDIS_URL: redis://redis:6379/0
|
|
depends_on:
|
|
postgres:
|
|
condition: service_started
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME}
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- /mnt/data/postgres:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"pg_isready",
|
|
"-U",
|
|
"${DB_USER}",
|
|
"-d",
|
|
"${DB_NAME}",
|
|
]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --save "" --appendonly no
|
|
restart: unless-stopped
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 5s
|