Container images
Build with a base image from packages.example.com
Change the FROM line and log in before you build.
$ cat Dockerfile FROM packages.example.com/node:22-alpine WORKDIR /app COPY server.js . CMD ["node", "server.js"] $ docker build -t storefront:dev . ... #6 extracting sha256:16da5a6403776464b5bf551ef294de57da242eac594527ea551a46e7f76ac2d6 done #6 DONE 3.9s #7 [2/3] WORKDIR /app #7 DONE 0.0s #8 [3/3] COPY server.js . #8 DONE 0.0s #9 exporting to image #9 exporting layers 0.0s done #9 writing image sha256:c37920df3f243ade153858121ff7166f690a6af67e18aee3d00100ec5a067989 done #9 naming to docker.io/library/storefront:dev done #9 DONE 0.0s
Captured by running these commands against a real ForgeRepo™.
Change every FROM line, including the ones in multi-stage builds. The build uses the login you made with docker login.
Dockerfile
FROM packages.example.com/node:22-alpine AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM packages.example.com/nginx:stable-alpine
COPY --from=build /app/dist /usr/share/nginx/html
Careful
A RUN npm ci inside the build does not see your NPM_TOKEN. Pass it as a build secret, never as a build argument, because build arguments are saved in the image. See npm inside a docker build.