added dockerfile and build
This commit is contained in:
parent
1b4000f38a
commit
bee32ca3c1
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
.idea/
|
||||
dist/
|
||||
19
docker/common/nginx/default.conf
Normal file
19
docker/common/nginx/default.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
listen 8080;
|
||||
proxy_hide_header WWW-Authenticate;
|
||||
root /usr/share/nginx/html;
|
||||
location / {
|
||||
index index.html;
|
||||
expires -1;
|
||||
proxy_hide_header WWW-Authenticate;
|
||||
try_files $uri$args $uri$args/ $uri $uri/ /index.html =404;
|
||||
}
|
||||
gzip_min_length 1000;
|
||||
gzip on;
|
||||
gzip_http_version 1.0;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_types application/javascript text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
}
|
||||
32
docker/red-ui-app/Dockerfile
Normal file
32
docker/red-ui-app/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
### 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"]
|
||||
8
docker/red-ui-app/docker-entrypoint.sh
Executable file
8
docker/red-ui-app/docker-entrypoint.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
CLIENT_ID="${CLIENT_ID:-false}"
|
||||
|
||||
echo '{
|
||||
"CLIENT_ID":"'"$CLIENT_ID"' }' > /usr/share/nginx/html/config.json
|
||||
|
||||
nginx -g 'daemon off;'
|
||||
Loading…
x
Reference in New Issue
Block a user