Files
Notizarr/docker/docker-compose.yml
T
2026-09-07 09:54:30 +00:00

88 lines
3.4 KiB
YAML

# Dev stack: hot-reload container + Postgres, for local development on this
# machine. NOT what gets deployed to Unraid — see docker-compose.prod.yml
# and docs/phase1/06-docker-unraid-design.md for that.
#
# Run from the repo root:
# docker compose -f docker/docker-compose.yml up -d
#
# Reads a .env file from the repo root (Compose's default project
# directory, since that's the CWD the command above is run from) — copy
# .env.example to .env there and fill in real values first.
#
# Host ports are overridable (Unraid boxes commonly already have something
# on 8080/5432) — e.g.:
# HOST_PORT_WEB=18080 HOST_PORT_INGEST=18081 HOST_PORT_PG=15432 \
# docker compose -f docker/docker-compose.yml up -d
# or put those in the same .env file so you don't have to repeat them.
#
# IMPORTANT: whenever a package.json dependency changes, `--build` alone is
# not enough — Compose reuses the OLD container's anonymous node_modules
# volumes by default instead of repopulating them from the rebuilt image.
# Use:
# docker compose -f docker/docker-compose.yml up -d --build --force-recreate -V
# (-V / --renew-anon-volumes forces those volumes to be recreated from the
# new image; it does not touch the named notizarr_dev_pgdata volume below.)
services:
postgres:
image: postgres:16-alpine
container_name: notizarr-postgres-dev
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-notizarr}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
POSTGRES_DB: ${POSTGRES_DB:-notizarr}
ports:
- "127.0.0.1:${HOST_PORT_PG:-15432}:5432"
volumes:
- notizarr_dev_pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-notizarr} -d ${POSTGRES_DB:-notizarr}"]
interval: 5s
timeout: 5s
retries: 10
notizarr:
build:
context: ..
dockerfile: apps/server/Dockerfile
target: dev
container_name: notizarr-dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
NODE_ENV: development
PORT_WEB: "8080"
PORT_INGEST: "8081"
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:?set PUBLIC_BASE_URL in .env}
DATABASE_URL: postgres://${POSTGRES_USER:-notizarr}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}@postgres:5432/${POSTGRES_DB:-notizarr}
LOG_LEVEL: ${LOG_LEVEL:-debug}
AUTH_MODE: ${AUTH_MODE:-disabled}
INGESTION_ALLOWED_CIDRS: ${INGESTION_ALLOWED_CIDRS:-0.0.0.0/0}
# Apple's push service (web.push.apple.com) rejects VAPID JWTs whose
# `sub` claim isn't a real mailto:/https: value with a 403 — the
# config.ts fallback (mailto:admin@localhost) trips exactly that.
VAPID_SUBJECT: ${VAPID_SUBJECT:?set VAPID_SUBJECT in .env}
ports:
- "${HOST_PORT_WEB:-18080}:8080"
- "${HOST_PORT_INGEST:-18081}:8081"
volumes:
- ..:/workspace
# Anonymous volumes over node_modules so the bind mount above doesn't
# shadow the dependencies installed into the image at build time.
- /workspace/node_modules
- /workspace/apps/server/node_modules
- /workspace/apps/web/node_modules
- /workspace/packages/shared/node_modules
healthcheck:
test: ["CMD", "node", "apps/server/healthcheck.js"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
volumes:
notizarr_dev_pgdata: