fix: switch dev compose to bridge network, configurable API_PORT and WEB_PORT
This commit is contained in:
parent
88e18d9dac
commit
4fb3b7d143
3 changed files with 17 additions and 9 deletions
|
|
@ -26,6 +26,7 @@ RUN conda run -n pagepiper pip install --no-cache-dir -e "/app/circuitforge-core
|
||||||
WORKDIR /app/pagepiper
|
WORKDIR /app/pagepiper
|
||||||
RUN conda run -n pagepiper pip install --no-cache-dir -e .
|
RUN conda run -n pagepiper pip install --no-cache-dir -e .
|
||||||
|
|
||||||
EXPOSE 8522
|
ENV API_PORT=8522
|
||||||
CMD ["conda", "run", "--no-capture-output", "-n", "pagepiper", \
|
EXPOSE $API_PORT
|
||||||
"uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8522"]
|
CMD conda run --no-capture-output -n pagepiper \
|
||||||
|
uvicorn app.main:app --host 0.0.0.0 --port ${API_PORT}
|
||||||
|
|
|
||||||
15
compose.yml
15
compose.yml
|
|
@ -3,21 +3,28 @@ services:
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: pagepiper/Dockerfile
|
dockerfile: pagepiper/Dockerfile
|
||||||
network_mode: host
|
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/pagepiper/data
|
- ./data:/app/pagepiper/data
|
||||||
- ${PAGEPIPER_BOOKS_DIR:-./books}:/books:ro
|
- ${PAGEPIPER_BOOKS_DIR:-./books}:/books:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- pagepiper-dev-net
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/web/Dockerfile
|
dockerfile: docker/web/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8521:80"
|
- "${WEB_PORT:-8521}:80"
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
|
networks:
|
||||||
|
- pagepiper-dev-net
|
||||||
|
|
||||||
|
networks:
|
||||||
|
pagepiper-dev-net:
|
||||||
|
driver: bridge
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ server {
|
||||||
try_files $uri $uri/ /index.html;
|
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/ {
|
location /api/ {
|
||||||
proxy_pass http://host.docker.internal:8522;
|
proxy_pass http://api:8522;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue