Skip to content

docs(dockerfile): warn about the npm omit=dev + tsc build trap in TypeScript Actors#2716

Draft
DaveHanns wants to merge 1 commit into
masterfrom
docs-typescript-dockerfile-omit-dev-warning
Draft

docs(dockerfile): warn about the npm omit=dev + tsc build trap in TypeScript Actors#2716
DaveHanns wants to merge 1 commit into
masterfrom
docs-typescript-dockerfile-omit-dev-warning

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

Summary

Add a :::warning callout on the Source code page explaining the npm install --omit=dev + tsc build trap that breaks Docker builds for TypeScript Actors.

Why

The canonical Dockerfile on this page uses --omit=dev, which is correct for JavaScript Actors but silently drops typescript from the image. Any TS Actor whose build script invokes tsc fails at image-build time with sh: tsc: not found, even though the code compiles cleanly locally. We see this hit every fresh TS Actor at least once — burning a remote build cycle each retry.

The callout gives two concrete remediations (multi-stage build, or single-stage keeping devDeps) plus the failure signature so users searching their build logs can find it.

Test plan

  • Preview the page locally and verify the warning renders and links correctly.
  • Confirm the multi-stage Dockerfile example builds a valid image for a TS Actor and produces the expected slimmer output layer.
  • Consider a companion PR to the TypeScript template repo to bake the multi-stage remediation into ts-empty.

…eScript Actors

The canonical Node.js Dockerfile on this page uses `npm install --omit=dev`, which drops `devDependencies` and thus removes `typescript` from the image. Any TypeScript Actor whose `build` script invokes `tsc` will fail inside the Docker build with `tsc: not found`. This is a recurring pitfall — agents and users both hit it once per new TS Actor, and each retry burns a remote build cycle.

Add a `:::warning` callout under the sample Dockerfile with two concrete fixes (multi-stage build, or single-stage with devDeps kept in) and the failure signature so it can be recognized from logs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@apify-service-account

apify-service-account commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ Preview for this PR (commit 380d9c3) is ready at https://pr-2716.preview.docs.apify.com (see action run).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants