Last active
August 14, 2018 16:24
-
-
Save jinhduong/3e74c359a6d85e24e44aa41b550d9bf6 to your computer and use it in GitHub Desktop.
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
# 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/[email protected] -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