Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion node-playwright-camoufox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG NODE_VERSION=

# Use trixie to be consistent across node versions.
FROM node:${NODE_VERSION}-trixie-slim

Check warning on line 5 in node-playwright-camoufox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-camoufox node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-camoufox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-camoufox node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-camoufox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-camoufox node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

# Playwright version is passed in the format `v1.57.0-` (matching the tag
# format used by the full node-playwright image). Stripped below before
Expand Down Expand Up @@ -66,13 +66,28 @@
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Cleanup time
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -90,6 +105,22 @@
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
\
Expand Down
33 changes: 32 additions & 1 deletion node-playwright-chrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG NODE_VERSION=

# Use trixie to be consistent across node versions.
FROM --platform=linux/amd64 node:${NODE_VERSION}-trixie-slim

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-chrome/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-chrome node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

# Playwright version is passed in the format `v1.57.0-` (matching the tag
# format used by the full node-playwright image). Stripped below before
Expand Down Expand Up @@ -81,13 +81,28 @@
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Cleanup time
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -105,6 +120,22 @@
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
33 changes: 32 additions & 1 deletion node-playwright-firefox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG NODE_VERSION=

# Use trixie to be consistent across node versions.
FROM node:${NODE_VERSION}-trixie-slim

Check warning on line 5 in node-playwright-firefox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-firefox node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-firefox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-firefox node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-firefox/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-firefox node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

# Playwright version is passed in the format `v1.57.0-` (matching the tag
# format used by the full node-playwright image). Stripped below before
Expand Down Expand Up @@ -71,13 +71,28 @@
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Cleanup time
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -95,6 +110,22 @@
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
33 changes: 32 additions & 1 deletion node-playwright-webkit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG NODE_VERSION=

# Use trixie to be consistent across node versions.
FROM --platform=linux/amd64 node:${NODE_VERSION}-trixie-slim

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright-webkit/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright-webkit node: 26, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG node:${NODE_VERSION}-trixie-slim results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

# Playwright version is passed in the format `v1.57.0-` (matching the tag
# format used by the full node-playwright image). Stripped below before
Expand Down Expand Up @@ -60,13 +60,28 @@
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Cleanup time
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -84,6 +99,22 @@
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
33 changes: 32 additions & 1 deletion node-playwright/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG PLAYWRIGHT_VERSION=

# Extend from the latest Playwright image
FROM --platform=linux/amd64 mcr.microsoft.com/playwright:${PLAYWRIGHT_VERSION}noble

Check warning on line 5 in node-playwright/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright node: 24, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 5 in node-playwright/Dockerfile

View workflow job for this annotation

GitHub Actions / img: node-playwright node: 22, apify: ^3.7.2, crawlee: ^3.17.0, pw: 1.62.1, cf: ^0.12.0, is-latest: true

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

# Add labels to the image to identify it as an Apify Actor
LABEL maintainer="support@apify.com" \
Expand Down Expand Up @@ -83,13 +83,28 @@
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Cleanup time
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -107,6 +122,22 @@
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
33 changes: 32 additions & 1 deletion node-puppeteer-chrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,28 @@ RUN apt update \
\
# Globally disable the update-notifier.
&& npm config --global set update-notifier false \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
# Cleanup
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb \
&& apt clean -y && apt autoremove -y \
&& rm -rf /root/.npm \
# This is needed to remove an annoying error message when running headful.
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
&& mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

# Run everything after as non-privileged user.
USER myuser
Expand All @@ -114,6 +129,22 @@ ENV NODE_ENV=production
# so we put back the old limit of 80kb, which seems to work just fine.
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000"

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
33 changes: 32 additions & 1 deletion node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,44 @@ RUN npm config --global set update-notifier false \
&& chown -R myuser:myuser /home/myuser \
&& mkdir -p /usr/src/app \
&& chown -R myuser:myuser /usr/src/app \
&& ln -s /usr/src/app /home/myuser
&& ln -s /usr/src/app /home/myuser \
\
# Install the latest Corepack so Actors can opt into yarn or pnpm; `enable` drops the shims into the global bin.
&& npm install -g corepack@latest \
&& corepack enable \
\
# Pre-create the shared package-manager cache dirs (see the *_CACHE_*/*_STORE_DIR env vars), world-writable so any
# user can populate them and `rm -rf` them at the end to reclaim space, regardless of which user the Actor runs as.
&& mkdir -p /pkg-cache/npm /pkg-cache/yarn /pkg-cache/pnpm/store /pkg-cache/pnpm/cache \
&& chmod -R 777 /pkg-cache \
\
# Point the default per-user npm cache dirs (~/.npm) at the shared cache, so tooling
# that bypasses NPM_CONFIG_CACHE - and templates that `rm -r ~/.npm` - keep working.
&& rm -rf /root/.npm /home/myuser/.npm \
&& ln -s /pkg-cache/npm /root/.npm \
&& ln -s /pkg-cache/npm /home/myuser/.npm

WORKDIR /usr/src/app

# Copy source code
COPY --chown=myuser:myuser package.json main.js .

# Send every package-manager cache to a single, dedicated location instead of $HOME.
# npm, yarn, and pnpm have no real "disable the cache" switch (unlike pip), so isolating
# their caches under /pkg-cache is the practical equivalent: the tree holds only throwaway
# cache data and can be wiped or mounted as tmpfs without touching installed dependencies.
ENV NPM_CONFIG_CACHE=/pkg-cache/npm \
YARN_CACHE_FOLDER=/pkg-cache/yarn \
YARN_GLOBAL_FOLDER=/pkg-cache/yarn \
PNPM_CONFIG_STORE_DIR=/pkg-cache/pnpm/store \
PNPM_CONFIG_CACHE_DIR=/pkg-cache/pnpm/cache

# Make pnpm and yarn use a flat, npm-style node_modules instead of their non-node_modules
# defaults (pnpm's symlinked store, yarn Berry's Plug'n'Play), so installed dependencies are
# plain copies that any tooling can resolve without symlinks or a PnP loader.
ENV PNPM_CONFIG_NODE_LINKER=hoisted \
YARN_NODE_LINKER=node-modules

# Install default dependencies, print versions of everything
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional --no-package-lock --prefer-online \
Expand Down
Loading