Created
June 26, 2017 14:33
-
-
Save vadjs/4e4e7d9db450d83673a7f09f5f9c3e0c to your computer and use it in GitHub Desktop.
Docker multistage
This file contains hidden or 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
# 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