Add: Dockerfile & nginx config for container prod setup
This commit is contained in:
parent
ccc8eb7264
commit
839aace50c
2 changed files with 52 additions and 0 deletions
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
### STAGE 1: Build ###
|
||||
FROM node:lts-alpine AS build
|
||||
|
||||
#### make the 'app' folder the current working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
#### copy both 'package.json' and 'package-lock.json' (if available)
|
||||
COPY package*.json ./
|
||||
|
||||
#### install angular cli
|
||||
RUN npm install -g @angular/cli
|
||||
|
||||
#### install project dependencies
|
||||
RUN npm install
|
||||
|
||||
#### copy things
|
||||
COPY . .
|
||||
|
||||
#### generate build --prod
|
||||
RUN npm run build --prod
|
||||
|
||||
### STAGE 2: Run ###
|
||||
FROM nginxinc/nginx-unprivileged
|
||||
|
||||
#### copy nginx conf
|
||||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
#### copy artifact build from the 'build environment'
|
||||
COPY --from=build /usr/src/app/dist/bookproject /usr/share/nginx/html
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
Loading…
Add table
Add a link
Reference in a new issue