Files
reader-api/docker-compose.yml
T
virtus ac5f5db447 Add Google OAuth configuration and enhance API functionality
- Updated .env.example with WEB_GOOGLE_CLIENT_ID and WEB_GOOGLE_CLIENT_SECRET for Google OAuth.
- Modified README.md to reflect changes in docker-compose for unified web and API deployment.
- Enhanced auth.py to support NextAuth JWT session cookies.
- Improved main.py with lifespan management and additional API endpoints.
- Added mod_overview endpoint in mod.py for MOD panel statistics.
- Updated docker-compose.yml for local API and web service configurations.
2026-03-30 13:55:12 +07:00

107 lines
2.6 KiB
YAML

services:
api:
build:
context: .
dockerfile: Dockerfile
image: reader-api:latest
container_name: reader-api
env_file:
- .env
ports:
- "8000:8000"
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
ports:
- "8001:8000"
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: