forked from 0xWheatyz/SPARC
feat: update Docker config to run API and dashboard services
- Switch from Alpine to Debian slim for better package compatibility - Add system dependencies for pdfplumber and psycopg2 - Configure separate services for API (port 8000) and dashboard (port 8501) - Add automatic database initialization via init-db service - Update documentation with simplified Docker setup - Remove need for separate docker-compose.prod.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+42
-8
@@ -12,25 +12,59 @@ services:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: sparc-app
|
||||
init-db:
|
||||
build: .
|
||||
container_name: sparc-init-db
|
||||
command: python scripts/init_database.py
|
||||
environment:
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/sparc
|
||||
USE_DATABASE: "true"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
|
||||
api:
|
||||
build: .
|
||||
container_name: sparc-api
|
||||
command: uvicorn SPARC.api:app --host 0.0.0.0 --port 8000
|
||||
environment:
|
||||
USE_DATABASE: true
|
||||
API_KEY: ${API_KEY}
|
||||
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/sparc
|
||||
USE_DATABASE: "true"
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
init-db:
|
||||
condition: service_completed_successfully
|
||||
volumes:
|
||||
- .:/app
|
||||
- ./patents:/app/patents
|
||||
restart: unless-stopped
|
||||
|
||||
dashboard:
|
||||
build: .
|
||||
container_name: sparc-dashboard
|
||||
command: streamlit run dashboard.py --server.port 8501 --server.address 0.0.0.0
|
||||
environment:
|
||||
API_KEY: ${API_KEY}
|
||||
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/sparc
|
||||
USE_DATABASE: "true"
|
||||
ports:
|
||||
- "8501:8501"
|
||||
depends_on:
|
||||
- api
|
||||
volumes:
|
||||
- ./patents:/app/patents
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user