Files
computer-playbook/roles/web-app-flowise/files/Dockerfile
kevinveenbirkenbachandClaude Opus 5 40f2bb933d fix(flowise): scope the shim path to its layer instead of a build arg
f58ff5522 gave the socket-timeout shim a single point of truth by way of a
defaulted ARG. test_arg_without_default.py forbids that tree-wide:

    roles/web-app-flowise/files/Dockerfile:7: ARG FLOWISE_SOCKET_TIMEOUT_SHIM carries a default

The rule's reasoning does not fit this value at all: "A defaulted ARG answers a
question the caller failed to answer. The build then succeeds against a base
image, version or path nobody chose." An ARG is a contract with the caller, and
nobody needs to answer where a temp file lives that is written on line 21 and
deleted on line 25 of the same layer.

f45df04bf1 shows the house pattern for the case where the value IS a caller
decision: it dropped PY_BASE's default from bridgy-fed and had compose.yml.j2
supply it. Doing that here would invent a build contract for a scratch file.

A shell variable keeps the single point of truth and narrows the scope on top of
it -- the name was visible across the whole build context as an ARG, and now
lives only inside this RUN. Same path, same three references, same build.

Suppression was available and not used: a nocheck marker would have kept the
wrong mechanism and hidden the reason it was wrong.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 00:20:29 +02:00

32 lines
1.0 KiB
Docker

ARG FLOWISE_BASE_IMAGE
ARG FLOWISE_BASE_TAG
FROM ${FLOWISE_BASE_IMAGE}:${FLOWISE_BASE_TAG}
ARG FLOWISE_VERSION
ARG FLOWISE_SQLITE_VERSION
RUN rm -rf /var/lib/apt/lists/* \
&& apt-get -o Acquire::Retries=3 update \
&& apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
chromium git python3 curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ENV FLOWISE_HOME=/opt/flowise
WORKDIR ${FLOWISE_HOME}
RUN shim=/tmp/socket-timeout.cjs \
&& echo 'require("http").globalAgent.options.timeout=60000;require("https").globalAgent.options.timeout=60000' > "$shim" \
&& npm init -y > /dev/null \
&& npm pkg set "overrides.better-sqlite3=^${FLOWISE_SQLITE_VERSION}" \
&& NODE_OPTIONS=--require="$shim" npm install --omit=dev "flowise@${FLOWISE_VERSION}" \
&& rm -f "$shim" \
&& ln -s "${FLOWISE_HOME}/node_modules/.bin/flowise" /usr/local/bin/flowise \
&& chown -R node:node "${FLOWISE_HOME}"
USER node
ENTRYPOINT ["flowise", "start"]