fix(docker): pin Python/npm dependency versions (#663)

- Add docker/requirements-base.txt (edge-tts) and requirements-skills.txt (10 packages)
- Pin versions: pip ~= (patch only), npm ^, anthropic >=0.88<2.0
- Add .npmrc with supportedArchitectures for Alpine musl builds
- Restore --frozen-lockfile (lockfile regenerated with musl entries)
- Pin @anthropic-ai/claude-code@^1.0.47

Closes #662
This commit is contained in:
Duc Nguyen authored and GitHub committed 2026-04-03 14:55:07 +07:00
1 parent 943b2eb3e5
commit 532aab4387
4 files changed
+48 -7

No files matched your search

+15 -7
View File
@@ -4,7 +4,9 @@
FROM node:22-alpine AS web-builder
RUN corepack enable && corepack prepare pnpm@10.28.2 --activate
WORKDIR /app
COPY ui/web/package.json ui/web/pnpm-lock.yaml ./
# Copy .npmrc first so pnpm resolves musl native bindings (needed on Alpine).
# The lockfile already includes musl entries thanks to supportedArchitectures in .npmrc.
COPY ui/web/.npmrc ui/web/package.json ui/web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY ui/web/ .
RUN pnpm build
@@ -63,6 +65,11 @@ ARG ENABLE_NODE=false
ARG ENABLE_FULL_SKILLS=false
ARG ENABLE_CLAUDE_CLI=false
# Copy pinned Python deps (cleaned up after install).
# requirements-base.txt: shared deps for ENABLE_PYTHON and ENABLE_FULL_SKILLS.
# requirements-skills.txt: additional deps only for ENABLE_FULL_SKILLS.
COPY docker/requirements-base.txt docker/requirements-skills.txt /tmp/
# Install ca-certificates + wget (healthcheck) + optional runtimes.
# ENABLE_FULL_SKILLS=true pre-installs all skill deps (larger image, no on-demand install needed).
# Otherwise, skill packages are installed on-demand via the admin UI.
@@ -74,23 +81,24 @@ RUN set -eux; \
if [ "$ENABLE_FULL_SKILLS" = "true" ]; then \
apk add --no-cache python3 py3-pip nodejs npm pandoc github-cli poppler-utils bash; \
pip3 install --no-cache-dir --break-system-packages \
pypdf openpyxl pandas python-pptx markitdown defusedxml lxml \
pdfplumber pdf2image anthropic; \
npm install -g --cache /tmp/npm-cache docx pptxgenjs; \
-r /tmp/requirements-base.txt -r /tmp/requirements-skills.txt; \
npm install -g --cache /tmp/npm-cache docx@^9.6.1 pptxgenjs@^4.0.1; \
rm -rf /tmp/npm-cache /root/.cache /var/cache/apk/*; \
else \
if [ "$ENABLE_PYTHON" = "true" ]; then \
apk add --no-cache python3 py3-pip; \
pip3 install --no-cache-dir --break-system-packages edge-tts; \
pip3 install --no-cache-dir --break-system-packages \
-r /tmp/requirements-base.txt; \
fi; \
if [ "$ENABLE_NODE" = "true" ] || [ "$ENABLE_CLAUDE_CLI" = "true" ]; then \
apk add --no-cache nodejs npm; \
fi; \
fi; \
if [ "$ENABLE_CLAUDE_CLI" = "true" ]; then \
npm install -g --cache /tmp/npm-cache @anthropic-ai/claude-code; \
npm install -g --cache /tmp/npm-cache @anthropic-ai/claude-code@^1.0.47; \
rm -rf /tmp/npm-cache; \
fi
fi; \
rm -f /tmp/requirements-base.txt /tmp/requirements-skills.txt
# Non-root user
RUN adduser -D -u 1000 -h /app goclaw
+7
View File
@@ -0,0 +1,7 @@
# Base Python dependencies — installed when ENABLE_PYTHON=true or ENABLE_FULL_SKILLS=true.
# Uses compatible release (~=) to allow patch updates within the same minor version.
# e.g. ~=7.2.8 allows >=7.2.8, <7.3.0
#
# Last reviewed: 2026-04-03
edge-tts~=7.2.8
+21
View File
@@ -0,0 +1,21 @@
# Additional Python dependencies for full skill runtime (ENABLE_FULL_SKILLS=true).
# Installed on top of requirements-base.txt.
# Uses compatible release (~=) to allow patch updates within the same minor version.
#
# Last reviewed: 2026-04-03
# Document processing
pypdf~=6.9.2
openpyxl~=3.1.5
python-pptx~=1.0.2
pdfplumber~=0.11.9
pdf2image~=1.17.0
markitdown<0.2.0
# Data & XML
pandas~=3.0.2
defusedxml~=0.7.1
lxml~=6.0.2
# AI SDK — relaxed to allow minor updates (fast-moving SDK)
anthropic>=0.88.0,<2.0.0
+5
View File
@@ -0,0 +1,5 @@
# Ensure pnpm fetches native bindings for both glibc and musl (Alpine Docker builds)
supportedArchitectures.cpu[]=arm64
supportedArchitectures.cpu[]=x64
supportedArchitectures.libc[]=musl
supportedArchitectures.libc[]=glibc