Skip to content

Instantly share code, notes, and snippets.

@wookets
Created September 10, 2019 15:30
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 wookets/8d3bd29053b8ba0862e5499b0c7d3558 to your computer and use it in GitHub Desktop.
Save wookets/8d3bd29053b8ba0862e5499b0c7d3558 to your computer and use it in GitHub Desktop.
Node api dockerfile
# first stage builds typescript
FROM mhart/alpine-node:12 AS build
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build
# second stage creates slim down packages
FROM mhart/alpine-node:12 AS cull
WORKDIR /app
COPY --from=build /app/dist ./
#RUN echo "from build" && pwd && ls
COPY package*.json ./
#RUN echo "from orginal" && pwd && ls
RUN npm install --prod
# third stage
FROM mhart/alpine-node:slim-12 AS slim
WORKDIR /app
#RUN echo "slim app" && pwd && ls
COPY --from=cull /app .
#RUN echo "slim copy from cull" && pwd && ls
#COPY . .
#RUN echo "copy from current" && pwd && ls
EXPOSE 8080
CMD ["node", "./src/server.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment