Created
February 12, 2019 15:00
-
-
Save tyhonchik/2ef2f4ae9f941f5199b0203bfead925e to your computer and use it in GitHub Desktop.
Multi stage Dockerfile for RAZZLE app
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
| # STEP 1: | |
| # build with pkg | |
| FROM node:latest AS build | |
| WORKDIR /app | |
| # install dependencies with cache | |
| COPY package.json . | |
| COPY yarn.lock . | |
| RUN yarn | |
| # copy app files, build and package | |
| COPY . /app | |
| RUN yarn package | |
| # ---------------- | |
| # STEP 2: | |
| # run with alpine | |
| FROM alpine:latest | |
| WORKDIR /app | |
| ENV NODE_ENV=production | |
| # install required libs | |
| RUN apk update && apk add --no-cache libstdc++ libgcc | |
| # copy prebuilt binary from previous step | |
| COPY --from=build /app/app /app/app | |
| CMD ["/app/app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment