Skip to content

perf: use slim Node base image, npm ci and tighter .dockerignore in JS/TS templates - #1184

Merged
metalwarrior665 merged 2 commits into
masterfrom
claude/fervent-hawking-dvqerk
Nov 10, 2026
Merged

metalwarrior665 merged 2 commits into
masterfrom
claude/fervent-hawking-dvqerk

Conversation

@metalwarrior665

@metalwarrior665 metalwarrior665 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

This applies Dockerfile practices from our store Actor repos to the JS and TS templates.

Changes:

  • The 14 templates on apify/actor-node:24 now use apify/actor-node:24-slim. Each template installs its own apify and crawlee, so the preinstalled copies only make the image bigger. The npm ls check of preinstalled packages is removed from these templates because it fails on slim. Browser templates keep their current base images.
  • Every npm install step uses npm ci when package-lock.json exists. Without a lockfile, which is the state of a newly created template, it falls back to npm install.
  • A comment before each COPY . ./ says that copying only the files the Actor needs gives more build cache hits. The copy stays as it is, so user projects do not break on missing files.
  • .dockerignore now also excludes:
    • .github in all templates.
    • test in all templates except js-cypress and ts-playwright-test-runner, because there the tests are the Actor.
    • dist in the TS templates that did not exclude it.
    • .husky, lefthook.yml, .claude, AGENTS.md, CLAUDE.md and vitest.config.ts in all templates. The templates ship AGENTS.md and CLAUDE.md. Our store repos commonly add the other files.

I did not build the images locally. The Docker build workflow in this PR's CI covers the fallback path, because the templates have no lockfile.

Possible existing issue, not changed here: ts-playwright-test-runner starts with node dist/main.js, but its Dockerfile has no build step and dist is in .gitignore.

🤖 Generated with Claude Code

https://claude.ai/code/session_016XtpQvUW4S4akcNA5XXGaQ

…JS/TS templates

- Non-browser templates use apify/actor-node:24-slim. The template installs its
  own apify and crawlee, so the preinstalled copies only add size. The npm ls
  check of preinstalled packages is removed, it fails on slim.
- Use npm ci when package-lock.json exists. Fall back to npm install without
  a lockfile, which is the state of a freshly created template.
- Add a comment before COPY . ./ that copying only the needed files gives
  more build cache hits.
- .dockerignore excludes .github, test and (for TS) dist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016XtpQvUW4S4akcNA5XXGaQ
@metalwarrior665 metalwarrior665 changed the title chore: use slim Node base image, npm ci and tighter .dockerignore in JS/TS templates perf: use slim Node base image, npm ci and tighter .dockerignore in JS/TS templates Nov 9, 2026
@metalwarrior665
metalwarrior665 marked this pull request as ready for review November 9, 2026 21:54

@l2ysho l2ysho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@metalwarrior665

Copy link
Copy Markdown
Member Author

I added a few more things we use to .dockerignore. In our testing library, we check dockerignore to see what can influence Actor code and we hope more community will adopt it.

@metalwarrior665
metalwarrior665 merged commit 9a3df24 into master Nov 10, 2026
61 of 62 checks passed
@metalwarrior665
metalwarrior665 deleted the claude/fervent-hawking-dvqerk branch November 10, 2026 10:14
@l2ysho

l2ysho commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

I added a few more things we use to .dockerignore. In our testing library, we check dockerignore to see what can influence Actor code and we hope more community will adopt it.

after recent events, .claude make perfect sense in gitignore, at least .claude/settings.local.json should be always there (CLI has open PR with this )

@metalwarrior665

Copy link
Copy Markdown
Member Author

I wouldn't put whole .claude there, teams are sharing their skills etc. But the local settings make sense

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.

3 participants