Replace hardcoded port literals with env-driven variables so a single change in .env reconfigures the full stack consistently. Defaults are unchanged (DB 5432, app 8765), so existing setups need no .env changes. - DB_PORT (default 5432): drives the db host<->container port mapping, Postgres PGPORT (so it listens on the chosen port), and the app's DATABASE_PORT connection setting. Lets deployers avoid a host port conflict (e.g. another local Postgres) by setting DB_PORT once. - SERVER_PORT (default 8765): drives the app host<->container mapping, the SERVER_PORT the app listens on, and the healthcheck target URL. - Applied to both the base (docker-compose.yml) and the dev override (docker-compose.dev.yml, tests service) so dev and prod stay in sync.
58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
# Development override — merged on top of docker-compose.yml (the base/prod file).
|
|
# Activated by all `make` targets via:
|
|
# COMPOSE = <runtime> compose -f docker-compose.yml -f docker-compose.dev.yml
|
|
#
|
|
# What this adds over prod:
|
|
# - Local image BUILDING (prod pulls a prebuilt image from the registry)
|
|
# - The integration-tests service (dev only, gated behind the "tests" profile)
|
|
# Everything else (env vars, volumes, ports, healthchecks) is inherited from the base file.
|
|
services:
|
|
# Build the app image locally instead of pulling from the registry
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: ./Dockerfile
|
|
|
|
# Integration Tests - runs against containerized app and db (dev only)
|
|
tests:
|
|
build:
|
|
context: .
|
|
dockerfile: ./Dockerfile
|
|
target: test-runner
|
|
container_name: bookhoard_tests
|
|
environment:
|
|
# Database Configuration
|
|
DATABASE_HOST: db
|
|
DATABASE_PORT: ${DB_PORT:-5432}
|
|
DATABASE_USER: postgres
|
|
DATABASE_PASSWORD: ${DBPASS}
|
|
DATABASE_NAME: bookhoard
|
|
COOKIE_SECURE: false
|
|
|
|
# Application Configuration
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
SERVER_PORT: ${SERVER_PORT:-8765}
|
|
|
|
# Test Configuration
|
|
TEST_MODE: "true"
|
|
RATE_LIMIT_ENABLED: "false"
|
|
REQUESTS_PER_MINUTE: 1000
|
|
|
|
# Conversion Service Configuration
|
|
BOOKHOARD_CONVERSION_CACHE_DIR: /app/cache/kepub
|
|
BOOKHOARD_CONVERSION_TOOL: /usr/bin/kepubify
|
|
BOOKHOARD_CONVERSION_CACHE_TTL: 24h
|
|
|
|
# Test upload path (inside container)
|
|
TEST_UPLOAD_PATH: /app/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
app:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
- bookhoard_conversion_cache:/app/cache/kepub
|
|
profiles:
|
|
- tests
|