fix: switch dev compose to bridge network, configurable API_PORT and WEB_PORT

This commit is contained in:
pyr0ball 2026-05-05 11:46:45 -07:00
parent 88e18d9dac
commit 4fb3b7d143
3 changed files with 17 additions and 9 deletions

View file

@ -26,6 +26,7 @@ RUN conda run -n pagepiper pip install --no-cache-dir -e "/app/circuitforge-core
WORKDIR /app/pagepiper
RUN conda run -n pagepiper pip install --no-cache-dir -e .
EXPOSE 8522
CMD ["conda", "run", "--no-capture-output", "-n", "pagepiper", \
"uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8522"]
ENV API_PORT=8522
EXPOSE $API_PORT
CMD conda run --no-capture-output -n pagepiper \
uvicorn app.main:app --host 0.0.0.0 --port ${API_PORT}

View file

@ -3,21 +3,28 @@ services:
build:
context: ..
dockerfile: pagepiper/Dockerfile
network_mode: host
env_file: .env
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./data:/app/pagepiper/data
- ${PAGEPIPER_BOOKS_DIR:-./books}:/books:ro
restart: unless-stopped
networks:
- pagepiper-dev-net
web:
build:
context: .
dockerfile: docker/web/Dockerfile
ports:
- "8521:80"
extra_hosts:
- "host.docker.internal:host-gateway"
- "${WEB_PORT:-8521}:80"
restart: unless-stopped
depends_on:
- api
networks:
- pagepiper-dev-net
networks:
pagepiper-dev-net:
driver: bridge

View file

@ -8,9 +8,9 @@ server {
try_files $uri $uri/ /index.html;
}
# Proxy API requests to FastAPI (host network, port 8522)
# Proxy API requests to FastAPI (Docker bridge, service name)
location /api/ {
proxy_pass http://host.docker.internal:8522;
proxy_pass http://api:8522;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}