Skip to content

Instantly share code, notes, and snippets.

@starlightromero
Created July 19, 2021 20:11
Show Gist options
  • Select an option

  • Save starlightromero/6714ccd8304be25a2f451401d62a7164 to your computer and use it in GitHub Desktop.

Select an option

Save starlightromero/6714ccd8304be25a2f451401d62a7164 to your computer and use it in GitHub Desktop.
Node Dockerfile.distroless-min
FROM node:14.17-alpine as build
WORKDIR /usr/src/app
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN apk update && apk add --no-cache curl=7.67.0-r4 && curl -sf https://gobinaries.com/tj/node-prune | sh
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --production && node-prune
FROM gcr.io/distroless/nodejs:14
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/build ./build
EXPOSE 8080
CMD [ "build/app.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment