Add docker setup.
This commit is contained in:
parent
3f22b1ab11
commit
81d7a6540d
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
.idea/
|
||||
dist/
|
||||
node_modules/
|
@ -44,6 +44,13 @@ build:
|
||||
expire_in: 1 days
|
||||
paths:
|
||||
- dist/cic-staff-client
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
paths:
|
||||
- node_modules
|
||||
policy: pull
|
||||
|
||||
test:karma:
|
||||
stage: test
|
||||
@ -57,6 +64,13 @@ test:karma:
|
||||
artifacts:
|
||||
paths:
|
||||
- coverage/
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
paths:
|
||||
- node_modules
|
||||
policy: pull
|
||||
|
||||
test:e2e:
|
||||
stage: test
|
||||
@ -66,6 +80,13 @@ test:e2e:
|
||||
- docker
|
||||
script:
|
||||
- ng e2e
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
paths:
|
||||
- node_modules
|
||||
policy: pull
|
||||
|
||||
test:nglint:
|
||||
stage: test
|
||||
@ -74,6 +95,13 @@ test:nglint:
|
||||
- docker
|
||||
script:
|
||||
- ng lint
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
paths:
|
||||
- node_modules
|
||||
policy: pull
|
||||
|
||||
build_app:
|
||||
stage: build_and_test
|
||||
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
### STAGE 1: Build ###
|
||||
# defining version of the base image
|
||||
FROM node:15.1.0-alpine as build
|
||||
|
||||
# defining work directory
|
||||
WORKDIR /app
|
||||
|
||||
# copying the json files into the image
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
# copying rest of project
|
||||
COPY . .
|
||||
|
||||
# running build script
|
||||
RUN npm run build --prod
|
||||
|
||||
### STAGE 2: Setup ###
|
||||
# defining nginx image version
|
||||
FROM nginx:1.19.4-alpine
|
||||
|
||||
## Remove default nginx website
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# copy dist output from our first image
|
||||
COPY --from=build /app/dist/cic-staff-client /usr/share/nginx/html
|
||||
|
||||
# copy nginx configuration file
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
8
nginx.conf
Normal file
8
nginx.conf
Normal file
@ -0,0 +1,8 @@
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user