Created
September 10, 2019 15:30
-
-
Save wookets/8d3bd29053b8ba0862e5499b0c7d3558 to your computer and use it in GitHub Desktop.
Node api dockerfile
This file contains 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
# 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