Last active
August 14, 2018 16:24
Star
You must be signed in to star a gist
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
# The builder from node image | |
FROM node:alpine as builder | |
# build-time variables | |
# prod|sandbox its value will be come from outside | |
ARG env=prod | |
RUN apk update && apk add --no-cache make git | |
# Move our files into directory name "app" | |
WORKDIR /app | |
COPY package.json package-lock.json /app/ | |
RUN npm install @angular/cli@6.0.8 -g | |
RUN cd /app && npm install | |
COPY . /app | |
# Build with $env variable from outside | |
RUN cd /app && npm run build:$env | |
# Build a small nginx image with static website | |
FROM nginx:alpine | |
RUN rm -rf /usr/share/nginx/html/* | |
COPY nginx.conf /etc/nginx/nginx.conf | |
COPY --from=builder /app/dist /usr/share/nginx/html | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment