Skip to content

Instantly share code, notes, and snippets.

@vadjs
Created June 26, 2017 14:33
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 vadjs/4e4e7d9db450d83673a7f09f5f9c3e0c to your computer and use it in GitHub Desktop.
Save vadjs/4e4e7d9db450d83673a7f09f5f9c3e0c to your computer and use it in GitHub Desktop.
Docker multistage
# IMPORTANT! Works with Docker 17.05+
FROM kkarczmarczyk/node-yarn AS buildContainer
# Create a directory where our app will be placed
RUN mkdir -p /tmp/src/app
# Change directory so that our commands run inside this new directory
WORKDIR /tmp/src/app
# Copy dependency definitions
COPY package.json .
COPY yarn.lock .
COPY .npmrc .
# Install dependecies
RUN yarn --frozen-lockfile
# Get all the code needed to run the app
COPY . .
# Serve the app
CMD yarn build:dev
# Builds a Docker to deliver dist/
FROM nginx:alpine
COPY --from=buildContainer /tmp/src/app/dist/ /usr/share/nginx/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment