Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
Created June 10, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazy4groovy/0aad8880089a93b205eaf62c00b931df to your computer and use it in GitHub Desktop.
Save crazy4groovy/0aad8880089a93b205eaf62c00b931df to your computer and use it in GitHub Desktop.
Build a "distroless" NodeJS docker image
FROM node:12.18.0 AS build-env
ADD . /app
WORKDIR /app
RUN npm ci --only=production
# https://github.com/GoogleContainerTools/distroless
# - considered experimental and not recommended for production usage!
# https://github.com/GoogleContainerTools/distroless/blob/master/examples/nodejs/Dockerfile
FROM gcr.io/distroless/nodejs
COPY --from=build-env /app /app
WORKDIR /app
CMD ["dist/index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment