Skip to content

Instantly share code, notes, and snippets.

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