Created
July 19, 2021 20:11
-
-
Save starlightromero/6714ccd8304be25a2f451401d62a7164 to your computer and use it in GitHub Desktop.
Node Dockerfile.distroless-min
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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