Files
bookapp/docker-compose.yml
Mike Wichers 493435e43c Auto-commit: v2.10 — Docker/compose hardening for Portainer on Pi
docker-compose.yml:
- Add PYTHONIOENCODING=utf-8 env var (guarantees UTF-8 stdout in all
  Python environments, including Docker slim images on ARM).
- Add logging driver section: json-file, max-size 10m, max-file 5.
  Without this the json-file log on a Raspberry Pi SD card grows
  unbounded and eventually kills the container or fills the disk.

web/requirements_web.txt:
- Pin huey==2.6.0 so a future pip upgrade cannot silently change the
  Consumer() API and re-introduce the loglevel= TypeError that caused
  all tasks to stay queued forever.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 12:07:27 -05:00

51 lines
1.8 KiB
YAML

version: '3.8'
services:
bookapp:
build: .
container_name: bookapp
restart: unless-stopped
ports:
- "5000:5000"
working_dir: /app
volumes:
# --- PERSISTENCE (Data & Login) ---
# These mounts ensure your projects and login tokens survive container resets
# HOST_PATH is defined in Portainer Environment Variables (e.g. /opt/bookapp)
- ${HOST_PATH:-.}/data:/app/data
- ${HOST_PATH:-.}/token.json:/app/token.json
- ${HOST_PATH:-.}/credentials.json:/app/credentials.json
# --- DEVELOPMENT (Code Sync) ---
# UNCOMMENT these lines only if you are developing and want to see changes instantly.
# For production/deployment, keep them commented out so the container uses the built image code.
# - ./core:/app/core
# - ./ai:/app/ai
# - ./story:/app/story
# - ./marketing:/app/marketing
# - ./export:/app/export
# - ./web:/app/web
# - ./cli:/app/cli
# - ./templates:/app/templates
environment:
- PYTHONUNBUFFERED=1
- PYTHONIOENCODING=utf-8
- GOOGLE_APPLICATION_CREDENTIALS=/app/credentials.json
- PYTHONPATH=/app
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY:-change_this_to_a_random_string}
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-change_me_in_portainer}
- FLASK_DEBUG=${FLASK_DEBUG:-False}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- GCP_PROJECT=${GCP_PROJECT:-}
- GCP_LOCATION=${GCP_LOCATION:-us-central1}
- MODEL_LOGIC=${MODEL_LOGIC:-AUTO}
- MODEL_WRITER=${MODEL_WRITER:-AUTO}
- MODEL_ARTIST=${MODEL_ARTIST:-AUTO}
- MODEL_IMAGE=${MODEL_IMAGE:-AUTO}
# Keep Docker logs bounded so they don't fill the Pi's SD card.
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"