Files
reader-api/docker-compose.yml
T
virtus 9a3bb4b6ce
Build and Push Reader API Image / docker (push) Successful in 1m3s
feat(storage): implement NAS content storage with read/write capabilities
feat(docker): configure NAS content and EPUB source directories in docker-compose

feat(migrations): add tables for SourceAsset, ImportJob, ChapterContentRef, and AssetNovelMapping

feat(scripts): create backfill script for populating ChapterContentRef from MongoDB chapters
2026-04-30 01:53:52 +07:00

120 lines
3.1 KiB
YAML

services:
api:
build:
context: .
dockerfile: Dockerfile
image: reader-api:latest
container_name: reader-api
env_file:
- .env
ports:
- "8000:8000"
environment:
NAS_CONTENT_ROOT: ${NAS_CONTENT_ROOT:-/data/content}
EPUB_SOURCE_ROOT: ${EPUB_SOURCE_ROOT:-/data/epub-source}
volumes:
- nas_chapter_content:/data/content
- nas_epub_source:/data/epub-source
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health').read()"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
# Local mode API: binds to local Postgres/Mongo containers.
api-local:
build:
context: .
dockerfile: Dockerfile
image: reader-api:latest
container_name: reader-api-local
profiles: ["localdb"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://reader:reader@postgres:5432/reader
MONGODB_URI: mongodb://mongo:27017/reader
NAS_CONTENT_ROOT: ${NAS_CONTENT_ROOT:-/data/content}
EPUB_SOURCE_ROOT: ${EPUB_SOURCE_ROOT:-/data/epub-source}
ports:
- "8001:8000"
volumes:
- nas_chapter_content:/data/content
- nas_epub_source:/data/epub-source
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health').read()"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
depends_on:
postgres:
condition: service_healthy
mongo:
condition: service_healthy
web:
build:
context: ../reader
dockerfile: Dockerfile
image: reader-web:latest
container_name: reader-web
environment:
NODE_ENV: production
PORT: 3000
READER_API_ORIGIN: http://api:8000
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
GOOGLE_CLIENT_ID: ${WEB_GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${WEB_GOOGLE_CLIENT_SECRET}
ports:
- "3000:3000"
volumes:
- web_uploads:/app/public/uploads
restart: unless-stopped
depends_on:
api:
condition: service_healthy
postgres:
image: postgres:16-alpine
container_name: reader-api-postgres
profiles: ["localdb"]
environment:
POSTGRES_DB: reader
POSTGRES_USER: reader
POSTGRES_PASSWORD: reader
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U reader -d reader"]
interval: 10s
timeout: 5s
retries: 10
mongo:
image: mongo:7
container_name: reader-api-mongo
profiles: ["localdb"]
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 10s
timeout: 5s
retries: 10
volumes:
web_uploads:
postgres_data:
mongo_data:
nas_chapter_content:
nas_epub_source: