From f74448c287279f91b2bb6744797b5e777d3f6671 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 8 May 2026 15:57:41 +0200 Subject: [PATCH] fix(docker): skip husky install in worker runner stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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) --- Dockerfile.worker | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile.worker b/Dockerfile.worker index c21a1c6..33d0d70 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -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