fix(docker): skip husky install in worker runner stage
Some checks failed
Build & Push Docker Images / lint (push) Successful in 1m27s
Build & Push Docker Images / build-and-push (push) Failing after 8m24s

`pnpm install --frozen-lockfile --prod` runs the package.json `prepare`
script (`husky`) but in --prod mode husky (a devDependency) isn't
installed → "sh: husky: not found" → install fails → Docker build dies.

`ENV HUSKY=0` is husky 9+'s official skip mechanism for CI/Docker
contexts. Adding it before the prod install in Dockerfile.worker.

The main Dockerfile is unaffected because its runner stage copies the
prebuilt `.next/standalone` rather than running pnpm install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 15:57:41 +02:00
parent 2f9bcf00b1
commit f74448c287

View File

@@ -29,6 +29,11 @@ WORKDIR /app
RUN chown -R worker:nodejs /app
USER worker
COPY --chown=worker:nodejs package.json pnpm-lock.yaml ./
# HUSKY=0 skips the husky install during the `prepare` script — husky is a
# dev dependency so it's not present in --prod installs, and without this
# guard pnpm install fails with "sh: husky: not found" (husky 9+ honors
# the HUSKY=0 env var as the official CI/Docker skip mechanism).
ENV HUSKY=0
RUN pnpm install --frozen-lockfile --prod
COPY --from=builder --chown=worker:nodejs /app/dist/worker.js ./worker.js
# Healthcheck — pings Redis from inside the worker container. Without