test: install enterprise S3 dep and open PS coders in docker test image

Two test-image gaps surfaced by a full pnpm test:ci run:

- s3-storage.test.ts imports @aws-sdk/client-s3 (an enterprise dependency) at module load, but Dockerfile.test never copied packages/enterprise/package.json before pnpm install, so the suite failed to collect. Copy it so the dep installs; the suite then skips cleanly when MinIO is absent.

- EPS batch decode returned 422: ImageMagick reads EPS through the Ghostscript PS coder, but policy.xml left PS/PS2/PS3 at rights=none (only EPS was opened), so convert refused with a policy error before Ghostscript ran. Open the PostScript coders too.
This commit is contained in:
SnapOtter
2026-06-17 14:28:41 +08:00
parent 63a2d309ce
commit 2d2f23cff0
+10 -3
View File
@@ -55,11 +55,15 @@ COPY --from=libheif-builder /opt/libheif/lib/ /usr/local/lib/
ENV LD_LIBRARY_PATH=/usr/local/lib
RUN ldconfig
# Allow ImageMagick's Ghostscript delegate to read/write EPS (the default
# Debian policy.xml blocks it).
# Allow ImageMagick's Ghostscript delegate to read EPS. Decoding an EPS goes
# through the PostScript (PS) coder, so the default Debian policy.xml blocking
# PS/PS2/PS3 must be opened too, not just EPS -- otherwise `convert` refuses with
# a policy error before Ghostscript ever runs.
RUN POLICY_FILE=$(find /etc/ImageMagick* -name policy.xml 2>/dev/null | head -1) && \
if [ -n "$POLICY_FILE" ]; then \
sed -i 's/<policy domain="coder" rights="none" pattern="EPS"/<policy domain="coder" rights="read|write" pattern="EPS"/' "$POLICY_FILE"; \
for CODER in EPS PS PS2 PS3; do \
sed -i "s/<policy domain=\"coder\" rights=\"none\" pattern=\"${CODER}\"/<policy domain=\"coder\" rights=\"read|write\" pattern=\"${CODER}\"/" "$POLICY_FILE"; \
done; \
fi
WORKDIR /app
@@ -73,6 +77,9 @@ COPY apps/api/package.json apps/api/tsconfig.json ./apps/api/
COPY packages/shared/package.json packages/shared/tsconfig.json ./packages/shared/
COPY packages/image-engine/package.json packages/image-engine/tsconfig.json ./packages/image-engine/
COPY packages/ai/package.json packages/ai/tsconfig.json ./packages/ai/
# enterprise ships @aws-sdk/client-s3, which tests/integration/s3-storage.test.ts
# imports at module load; without it that suite fails to collect.
COPY packages/enterprise/package.json packages/enterprise/tsconfig.json ./packages/enterprise/
# Install ALL dependencies (including devDependencies for testing)
RUN pnpm install --frozen-lockfile