Currently I use astefanutti/scratch-node. The concept in general is called distroless.
FROM node:12-alpine AS frontend WORKDIR /app COPY packages/web-frontend/package.json packages/web-frontend/yarn.lock ./ RUN yarn --frozen-lockfile COPY packages/web-frontend . RUN yarn build FROM node:12-alpine AS server WORKDIR /app COPY packages/web-server/package.json packages/web-server/yarn.lock ./ RUN yarn --frozen-lockfile COPY packages/web-server . RUN yarn build RUN yarn --production --frozen-lockfile FROM astefanutti/scratch-node:12 WORKDIR /app COPY --from=server /app/node_modules /app/dist ./ COPY --from=frontend /app/dist public EXPOSE 8080 ENTRYPOINT ["node", "dist/index.js"]
I think it is 97 MB.
I used yarn --frozen-lockfile, but for npm, it would be npm ci.
yarn --frozen-lockfile
npm ci
But scratch-node (and also perhaps alpine in general) is a little problematic if you use native modules, though. Not that it cannot be managed.
scratch-node
alpine
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Currently I use astefanutti/scratch-node. The concept in general is called distroless.
I think it is 97 MB.
I used
yarn --frozen-lockfile
, but for npm, it would benpm ci
.But
scratch-node
(and also perhapsalpine
in general) is a little problematic if you use native modules, though. Not that it cannot be managed.