# LEGO Instructions Manager - Docker Compose stack # # docker compose up -d --build # # Configuration lives in .env next to this file (copy .env.docker.example). # Created by: Jess Rogerson (yelling commands at Claude.AI) services: db: image: postgres:16-alpine container_name: lim-db restart: unless-stopped environment: POSTGRES_DB: ${POSTGRES_DB:-lim} POSTGRES_USER: ${POSTGRES_USER:-lim} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env} # Keeps index/sort behaviour stable across Postgres upgrades. POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" volumes: - lim-db:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-lim} -d ${POSTGRES_DB:-lim}"] interval: 10s timeout: 5s retries: 10 start_period: 20s # Not published to the host: only the app container needs to reach it. expose: - "5432" app: build: context: . dockerfile: Dockerfile image: lim:latest container_name: lim-app restart: unless-stopped depends_on: db: condition: service_healthy environment: FLASK_APP: run.py FLASK_ENV: production SECRET_KEY: ${SECRET_KEY:?SECRET_KEY must be set in .env} DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-lim}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-lim} UPLOAD_FOLDER: /data/uploads BACKUP_FOLDER: /data/backups BACKUP_KEEP: ${BACKUP_KEEP:-7} MAX_CONTENT_LENGTH: ${MAX_CONTENT_LENGTH:-52428800} SETS_PER_PAGE: ${SETS_PER_PAGE:-20} BRICKSET_API_KEY: ${BRICKSET_API_KEY:-} BRICKSET_USERNAME: ${BRICKSET_USERNAME:-} BRICKSET_PASSWORD: ${BRICKSET_PASSWORD:-} volumes: - lim-data:/data ports: - "${LIM_PORT:-8000}:8000" volumes: lim-db: lim-data: