Fix local Docker runner (no rg) and force mounted backend URLs
Browse files- docs/hf.md +2 -0
- run_docker_local.sh +8 -1
docs/hf.md
CHANGED
|
@@ -32,6 +32,8 @@ Run the Docker image locally before pushing to HF:
|
|
| 32 |
|
| 33 |
Then open `http://localhost:7860` and click **Start Conversation**.
|
| 34 |
|
|
|
|
|
|
|
| 35 |
If `7860` is already in use locally, run:
|
| 36 |
|
| 37 |
```bash
|
|
|
|
| 32 |
|
| 33 |
Then open `http://localhost:7860` and click **Start Conversation**.
|
| 34 |
|
| 35 |
+
Note: the local Docker runner forces `FRONTEND_WEBSOCKET_URL` to use the mounted backend (`/api/ws/conversation`) so you don’t accidentally point at `localhost:8000`.
|
| 36 |
+
|
| 37 |
If `7860` is already in use locally, run:
|
| 38 |
|
| 39 |
```bash
|
run_docker_local.sh
CHANGED
|
@@ -13,7 +13,7 @@ docker build -t "${IMAGE_NAME}" "${ROOT_DIR}"
|
|
| 13 |
port_in_use() {
|
| 14 |
local port="$1"
|
| 15 |
if command -v ss >/dev/null 2>&1; then
|
| 16 |
-
ss -ltn "sport = :${port}" 2>/dev/null |
|
| 17 |
fi
|
| 18 |
if command -v lsof >/dev/null 2>&1; then
|
| 19 |
lsof -nP -iTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1 && return 0 || return 1
|
|
@@ -53,9 +53,16 @@ if [[ -f "${ROOT_DIR}/.env" ]]; then
|
|
| 53 |
ENV_ARGS+=(--env-file "${ROOT_DIR}/.env")
|
| 54 |
fi
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
echo "Running container on http://localhost:${HOST_PORT}"
|
| 57 |
exec docker run --rm -it \
|
| 58 |
-p "${HOST_PORT}:${CONTAINER_PORT}" \
|
| 59 |
-e "PORT=${CONTAINER_PORT}" \
|
|
|
|
|
|
|
| 60 |
"${ENV_ARGS[@]}" \
|
| 61 |
"${IMAGE_NAME}"
|
|
|
|
| 13 |
port_in_use() {
|
| 14 |
local port="$1"
|
| 15 |
if command -v ss >/dev/null 2>&1; then
|
| 16 |
+
ss -ltn "sport = :${port}" 2>/dev/null | grep -q ":${port}\\b" && return 0 || return 1
|
| 17 |
fi
|
| 18 |
if command -v lsof >/dev/null 2>&1; then
|
| 19 |
lsof -nP -iTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1 && return 0 || return 1
|
|
|
|
| 53 |
ENV_ARGS+=(--env-file "${ROOT_DIR}/.env")
|
| 54 |
fi
|
| 55 |
|
| 56 |
+
# The app runs as a single process with the backend mounted at `/api`, so the
|
| 57 |
+
# in-container websocket target must point at the same server, not :8000.
|
| 58 |
+
INTERNAL_WS_URL="ws://127.0.0.1:${CONTAINER_PORT}/api/ws/conversation"
|
| 59 |
+
INTERNAL_API_BASE="http://127.0.0.1:${CONTAINER_PORT}/api"
|
| 60 |
+
|
| 61 |
echo "Running container on http://localhost:${HOST_PORT}"
|
| 62 |
exec docker run --rm -it \
|
| 63 |
-p "${HOST_PORT}:${CONTAINER_PORT}" \
|
| 64 |
-e "PORT=${CONTAINER_PORT}" \
|
| 65 |
+
-e "FRONTEND_WEBSOCKET_URL=${INTERNAL_WS_URL}" \
|
| 66 |
+
-e "FRONTEND_BACKEND_BASE_URL=${INTERNAL_API_BASE}" \
|
| 67 |
"${ENV_ARGS[@]}" \
|
| 68 |
"${IMAGE_NAME}"
|