33 lines
1003 B
Docker
33 lines
1003 B
Docker
### STAGE 1: Build ###
|
||
|
||
# We label our stage as ‘builder’
|
||
FROM node:12.2-alpine as builder
|
||
RUN apk add --update jq && rm -rf /var/cache/apk/*
|
||
COPY package.json yarn.lock ./
|
||
|
||
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
|
||
RUN yarn install && mkdir /ng-app && mv ./node_modules ./ng-app
|
||
|
||
WORKDIR /ng-app
|
||
|
||
COPY . .
|
||
|
||
## Build the angular app in production mode and store the artifacts in dist folder
|
||
RUN yarn lint
|
||
RUN npm version patch --no-git-tag-version
|
||
RUN yarn build --prod --project=red-ui-app
|
||
### STAGE 2: Setup ###
|
||
|
||
FROM nginx:1.17.6-alpine
|
||
|
||
## Copy our default nginx config
|
||
COPY docker/common/nginx/default.conf /etc/nginx/conf.d/
|
||
|
||
## Remove default nginx website
|
||
RUN rm -rf /usr/share/nginx/html/*
|
||
|
||
## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
|
||
COPY --from=builder /ng-app/dist/apps/red-ui-app /usr/share/nginx/html
|
||
COPY docker/red-ui-app/docker-entrypoint.sh /
|
||
CMD ["/docker-entrypoint.sh"]
|