Skip to content

Instantly share code, notes, and snippets.

@martindevnow
Last active June 25, 2019 19:11
Show Gist options
  • Save martindevnow/b1fa01f45bc60649396dc450acf2996b to your computer and use it in GitHub Desktop.
Save martindevnow/b1fa01f45bc60649396dc450acf2996b to your computer and use it in GitHub Desktop.
FROM node:9.11.1 as devBuild
## Set ENV Variables in the Image
ENV NODE_ENV=development
ENV PORT=8085
ENV BABEL_DISABLE_CACHE=1
## Prep node_modules
COPY package*.json /tmp/
RUN cd /tmp && npm install
## Prep application
WORKDIR /usr/src/app
## Import Node Modules
RUN cp -a /tmp/node_modules /usr/src/app/
## Run
EXPOSE 8085
CMD [ "npm", "run", "serve" ]
FROM node:9.11.1 as ciBuild
WORKDIR /usr/src/app
COPY . /usr/src/app/
COPY --from=devBuild /usr/src/app/node_modules ./node_modules
CMD [ "npm", "run", "serve" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment