Skip to content

Instantly share code, notes, and snippets.

@gabeklein
Created September 27, 2018 17:24
Show Gist options
  • Save gabeklein/7ef5c96c39ee61fce43efe7e4c2021a3 to your computer and use it in GitHub Desktop.
Save gabeklein/7ef5c96c39ee61fce43efe7e4c2021a3 to your computer and use it in GitHub Desktop.
FROM mhart/alpine-node:10 as base
WORKDIR /usr/src
COPY . .
# copy all the source stuff, excepting everything in .dockerignore
RUN yarn
# creates node_modules/ populates with dependancies
RUN yarn build
#creates live/ populates with transpiled code
RUN yarn --production
#(I assume) recreates node_modules/ without or deletes build dependancies
FROM mhart/alpine-node:base-10
WORKDIR /usr/src
ENV NODE_ENV="production"
COPY --from=base /usr/src/live .
#copies live/
#need to copy node_modules/ too but shouldn't I avoid multiple layers?
CMD ["node", "live"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment