- Remove multi-stage Dockerfile (não compatível com Swarm) - Dockerfile.api: imagem standalone para API FastAPI - Dockerfile.web: imagem standalone para Streamlit - docker-compose.yml: aponta para os Dockerfiles separados - README.md: instruções de build individual + deploy Swarm
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
services:
|
|
|
|
# ── API REST (FastAPI) ──────────────────────────────────────────
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.api
|
|
image: pdf-toolkit-api:latest
|
|
container_name: pdf-toolkit-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${API_PORT:-8555}:8555"
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- PDFTOOLKIT_API_KEY=${PDFTOOLKIT_API_KEY:-}
|
|
volumes:
|
|
- uploads:/tmp/uploads
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import http.client; conn=http.client.HTTPConnection('localhost:8555'); conn.request('GET','/health'); r=conn.getresponse(); exit(0 if r.status==200 else 1)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
networks:
|
|
- pdf-net
|
|
|
|
# ── Interface Web (Streamlit) ───────────────────────────────────
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.web
|
|
image: pdf-toolkit-web:latest
|
|
container_name: pdf-toolkit-web
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${WEB_PORT:-8550}:8550"
|
|
depends_on:
|
|
- api
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- API_BASE_URL=http://api:8555
|
|
volumes:
|
|
- uploads:/tmp/uploads
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import http.client; conn=http.client.HTTPConnection('localhost:8550'); conn.request('GET','/'); r=conn.getresponse(); exit(0 if r.status==200 else 1)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
networks:
|
|
- pdf-net
|
|
|
|
volumes:
|
|
uploads:
|
|
|
|
networks:
|
|
pdf-net:
|
|
driver: bridge |