mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Skip engine free-port probe in containers (fixed port)
This commit is contained in:
+32
-4
@@ -37,9 +37,23 @@ tasks:
|
||||
dir: src
|
||||
vars:
|
||||
# When PORT is provided (e.g. from dev:all), use it directly.
|
||||
# When running standalone, probe for a free port starting at 5001.
|
||||
# With ENGINE_PORT_PROBE=false (Docker), use the fixed STIRLING_ENGINE_PORT
|
||||
# (default 5001) without probing. Otherwise probe for a free port from 5001.
|
||||
PORT:
|
||||
sh: '{{if .PORT}}echo {{.PORT}}{{else if eq OS "windows"}}{{.ENGINE_FIND_FREE_PORT_PS}} 5001{{else}}{{.ENGINE_FIND_FREE_PORT_SH}} 5001{{end}}'
|
||||
sh: |
|
||||
if [ -n "{{.PORT}}" ]; then
|
||||
echo "{{.PORT}}"
|
||||
elif [ -f /.dockerenv ] || [ "${ENGINE_PORT_PROBE:-true}" = "false" ]; then
|
||||
# Never probe in a container: the port is fixed and the probe script
|
||||
# isn't shipped in the image. /.dockerenv auto-detects Docker; the
|
||||
# ENGINE_PORT_PROBE=false flag forces fixed-port mode anywhere else.
|
||||
# The probe is a dev-only convenience for avoiding local port clashes.
|
||||
echo "${STIRLING_ENGINE_PORT:-5001}"
|
||||
elif [ "{{OS}}" = "windows" ]; then
|
||||
{{.ENGINE_FIND_FREE_PORT_PS}} 5001
|
||||
else
|
||||
{{.ENGINE_FIND_FREE_PORT_SH}} 5001
|
||||
fi
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
cmds:
|
||||
@@ -52,9 +66,23 @@ tasks:
|
||||
dir: src
|
||||
vars:
|
||||
# When PORT is provided (e.g. from dev:all), use it directly.
|
||||
# When running standalone, probe for a free port starting at 5001.
|
||||
# With ENGINE_PORT_PROBE=false (Docker), use the fixed STIRLING_ENGINE_PORT
|
||||
# (default 5001) without probing. Otherwise probe for a free port from 5001.
|
||||
PORT:
|
||||
sh: '{{if .PORT}}echo {{.PORT}}{{else if eq OS "windows"}}{{.ENGINE_FIND_FREE_PORT_PS}} 5001{{else}}{{.ENGINE_FIND_FREE_PORT_SH}} 5001{{end}}'
|
||||
sh: |
|
||||
if [ -n "{{.PORT}}" ]; then
|
||||
echo "{{.PORT}}"
|
||||
elif [ -f /.dockerenv ] || [ "${ENGINE_PORT_PROBE:-true}" = "false" ]; then
|
||||
# Never probe in a container: the port is fixed and the probe script
|
||||
# isn't shipped in the image. /.dockerenv auto-detects Docker; the
|
||||
# ENGINE_PORT_PROBE=false flag forces fixed-port mode anywhere else.
|
||||
# The probe is a dev-only convenience for avoiding local port clashes.
|
||||
echo "${STIRLING_ENGINE_PORT:-5001}"
|
||||
elif [ "{{OS}}" = "windows" ]; then
|
||||
{{.ENGINE_FIND_FREE_PORT_PS}} 5001
|
||||
else
|
||||
{{.ENGINE_FIND_FREE_PORT_SH}} 5001
|
||||
fi
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
cmds:
|
||||
|
||||
@@ -27,6 +27,10 @@ COPY .taskfiles/ ./.taskfiles/
|
||||
ENV PATH="/app/engine/.venv/bin:$PATH"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV STIRLING_ENGINE_WORKERS=4
|
||||
# Container runs on a fixed port; skip the host-only free-port probe (its script
|
||||
# is not shipped in the image). engine:run honours these.
|
||||
ENV ENGINE_PORT_PROBE=false
|
||||
ENV STIRLING_ENGINE_PORT=5001
|
||||
|
||||
EXPOSE 5001
|
||||
|
||||
|
||||
Reference in New Issue
Block a user