Created
June 14, 2019 19:32
-
-
Save sandeep540/a50abc3f316efbcc7251ac05da3ddc48 to your computer and use it in GitHub Desktop.
Angular Dockerfile with multistage
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
# Multi-step Docker File Builder | |
# STEP 1 : Choosing the Base of our image | |
FROM node:alpine as builder | |
ARG env=prod | |
#Adding label for tagging purpose | |
LABEL maintainer="[email protected]" | |
#STEP 2: Updating APK for updating Alpine Docker Image | |
RUN apk update && apk add --no-cache make git | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
RUN npm run build:${env} | |
# STEP 2 build a small nginx image with static website | |
FROM nginx:alpine | |
## Remove default nginx website | |
RUN rm -rf /usr/share/nginx/html/* | |
## */ | |
## From 'builder' copy website to default nginx public folder | |
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/nginx.conf | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] | |
## docker build -t sandeep540/flex-angular-app . | |
## docker push sandeep540/flex-angular-app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment