Merge branch 'master' into spencer/accounts-search
This commit is contained in:
commit
5f271227bc
218
.gitlab-ci.yml
218
.gitlab-ci.yml
@ -1,102 +1,134 @@
|
||||
stages:
|
||||
- install
|
||||
- build
|
||||
- test
|
||||
- package
|
||||
# - test
|
||||
# - package
|
||||
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
paths:
|
||||
- node_modules/
|
||||
policy: pull
|
||||
|
||||
image: node:alpine
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
|
||||
variables:
|
||||
PROJECT_PATH: "$CI_PROJECT_DIR"
|
||||
APP_OUTPUT_PATH: "$CI_PROJECT_DIR/dist/cic-staff-client"
|
||||
OUTPUT_PATH: "$CI_PROJECT_DIR/dist"
|
||||
CLI_VERSION: 10.2.0
|
||||
KANIKO_CACHE_ARGS: "--cache=true --cache-copy-layers=true --cache-ttl=24h"
|
||||
|
||||
install_dependencies:
|
||||
stage: install
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- npm install -g @angular/cli@$CLI_VERSION
|
||||
- npm install
|
||||
only:
|
||||
refs:
|
||||
- merge_requests
|
||||
- master
|
||||
changes:
|
||||
- package-lock.json
|
||||
|
||||
build:
|
||||
ng_build_merge_request:
|
||||
stage: build
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- npm ng build --prod
|
||||
after_script:
|
||||
- mv $PROJECT_PATH/nginx.conf $PROJECT_PATH/default.conf
|
||||
- cp $PROJECT_PATH/default.conf $APP_OUTPUT_PATH
|
||||
- cp $PROJECT_PATH/Dockerfile $APP_OUTPUT_PATH
|
||||
artifacts:
|
||||
name: "cic-staff-client-pipeline"
|
||||
expire_in: 1 days
|
||||
paths:
|
||||
- $APP_OUTPUT_PATH
|
||||
|
||||
test:karma:
|
||||
stage: test
|
||||
allow_failure: false
|
||||
tags:
|
||||
- docker
|
||||
before_script:
|
||||
- apk add chromium
|
||||
- export CHROME_BIN=/usr/bin/chromium-browser
|
||||
script:
|
||||
- npm ng test --code-coverage --progress false --watch false --browsers=GitlabChromeHeadless
|
||||
coverage: '/Statements\s+:\s\d+.\d+%/'
|
||||
artifacts:
|
||||
name: "tests-and-coverage"
|
||||
reports:
|
||||
junit:
|
||||
- $OUTPUT_PATH/tests/junit-test-results.xml
|
||||
cobertura:
|
||||
- $OUTPUT_PATH/coverage/cobetura-coverage.xml
|
||||
paths:
|
||||
- coverage/
|
||||
|
||||
test:e2e:
|
||||
stage: test
|
||||
allow_failure: false
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- npm ng e2e
|
||||
|
||||
test:nglint:
|
||||
stage: test
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- npm ng lint
|
||||
|
||||
docker-build:
|
||||
stage: package
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
variables:
|
||||
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
|
||||
before_script:
|
||||
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker build -t $IMAGE_TAG -f Dockerfile .
|
||||
- docker push $IMAGE_TAG
|
||||
only:
|
||||
- master
|
||||
- mkdir -p /kaniko/.docker
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
|
||||
- /kaniko/executor --context . $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --no-push
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
when: always
|
||||
|
||||
ng_build:
|
||||
stage: build
|
||||
variables:
|
||||
IMAGE_TAG_BASE: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
|
||||
LATEST_TAG: $CI_REGISTRY_IMAGE:latest
|
||||
script:
|
||||
- export IMAGE_TAG="$IMAGE_TAG_BASE-$(date +%F.%H%M%S)"
|
||||
- mkdir -p /kaniko/.docker
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
|
||||
- /kaniko/executor --context . $KANIKO_CACHE_ARGS --destination $IMAGE_TAG --destination $CI_REGISTRY_IMAGE:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "master"
|
||||
when: always
|
||||
|
||||
|
||||
# cache:
|
||||
# key:
|
||||
# files:
|
||||
# - package-lock.json
|
||||
# paths:
|
||||
# - node_modules/
|
||||
# policy: pull
|
||||
|
||||
# image: node:alpine
|
||||
|
||||
# variables:
|
||||
# PROJECT_PATH: "$CI_PROJECT_DIR"
|
||||
# APP_OUTPUT_PATH: "$CI_PROJECT_DIR/dist/cic-staff-client"
|
||||
# OUTPUT_PATH: "$CI_PROJECT_DIR/dist"
|
||||
# CLI_VERSION: 10.2.0
|
||||
|
||||
# install_dependencies:
|
||||
# stage: install
|
||||
# tags:
|
||||
# - docker
|
||||
# script:
|
||||
# - npm install -g @angular/cli@$CLI_VERSION
|
||||
# - npm install
|
||||
# only:
|
||||
# refs:
|
||||
# - merge_requests
|
||||
# - master
|
||||
# changes:
|
||||
# - package-lock.json
|
||||
|
||||
# build:
|
||||
# stage: build
|
||||
# tags:
|
||||
# - docker
|
||||
# script:
|
||||
# - npm ng build --prod
|
||||
# after_script:
|
||||
# - mv $PROJECT_PATH/nginx.conf $PROJECT_PATH/default.conf
|
||||
# - cp $PROJECT_PATH/default.conf $APP_OUTPUT_PATH
|
||||
# - cp $PROJECT_PATH/Dockerfile $APP_OUTPUT_PATH
|
||||
# artifacts:
|
||||
# name: "cic-staff-client-pipeline"
|
||||
# expire_in: 1 days
|
||||
# paths:
|
||||
# - $APP_OUTPUT_PATH
|
||||
|
||||
# test:karma:
|
||||
# stage: test
|
||||
# allow_failure: false
|
||||
# tags:
|
||||
# - docker
|
||||
# before_script:
|
||||
# - apk add chromium
|
||||
# - export CHROME_BIN=/usr/bin/chromium-browser
|
||||
# script:
|
||||
# - npm ng test --code-coverage --progress false --watch false --browsers=GitlabChromeHeadless
|
||||
# coverage: '/Statements\s+:\s\d+.\d+%/'
|
||||
# artifacts:
|
||||
# name: "tests-and-coverage"
|
||||
# reports:
|
||||
# junit:
|
||||
# - $OUTPUT_PATH/tests/junit-test-results.xml
|
||||
# cobertura:
|
||||
# - $OUTPUT_PATH/coverage/cobetura-coverage.xml
|
||||
# paths:
|
||||
# - coverage/
|
||||
|
||||
# test:e2e:
|
||||
# stage: test
|
||||
# allow_failure: false
|
||||
# tags:
|
||||
# - docker
|
||||
# script:
|
||||
# - npm ng e2e
|
||||
|
||||
# test:nglint:
|
||||
# stage: test
|
||||
# tags:
|
||||
# - docker
|
||||
# script:
|
||||
# - npm ng lint
|
||||
|
||||
# docker-build:
|
||||
# stage: package
|
||||
# image: docker:latest
|
||||
# services:
|
||||
# - docker:dind
|
||||
# variables:
|
||||
# IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
|
||||
# before_script:
|
||||
# - docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
|
||||
# script:
|
||||
# - docker build -t $IMAGE_TAG -f Dockerfile .
|
||||
# - docker push $IMAGE_TAG
|
||||
# only:
|
||||
# - master
|
||||
|
12
Dockerfile
12
Dockerfile
@ -1,4 +1,3 @@
|
||||
### STAGE 1: Build ###
|
||||
# defining version of the base image
|
||||
FROM node:alpine as build
|
||||
|
||||
@ -6,15 +5,16 @@ FROM node:alpine as build
|
||||
WORKDIR /app
|
||||
|
||||
# copying the json files into the image
|
||||
COPY package*.json ./
|
||||
COPY package*.json .
|
||||
COPY patch-webpack.js .
|
||||
|
||||
RUN npm install
|
||||
|
||||
# copying rest of project
|
||||
|
||||
COPY . .
|
||||
|
||||
# running build script
|
||||
RUN npm run build --prod
|
||||
RUN npm run build:dev
|
||||
|
||||
### STAGE 2: Setup ###
|
||||
# defining nginx image version
|
||||
@ -27,8 +27,8 @@ RUN rm -rf /usr/share/nginx/html/*
|
||||
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
|
||||
COPY nginx.conf /etc/nginx/
|
||||
|
||||
EXPOSE 80 443
|
||||
EXPOSE 80
|
||||
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
||||
|
11
angular.json
11
angular.json
@ -69,6 +69,14 @@
|
||||
"maximumError": "10kb"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dev": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.dev.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -80,6 +88,9 @@
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "cic-staff-client:build:production"
|
||||
},
|
||||
"dev": {
|
||||
"browserTarget": "cic-staff-client:build:dev"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
33
nginx.conf
33
nginx.conf
@ -1,3 +1,35 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
@ -6,3 +38,4 @@ server {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
package.json
12
package.json
@ -2,15 +2,13 @@
|
||||
"name": "cic-staff-client",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"config:dev": "ts-node set-env.ts --environment=dev",
|
||||
"config:prod": "ts-node set-env.ts --environment=prod",
|
||||
"start:dev": "npm run config:dev && ng serve",
|
||||
"start:prod": "npm run config:prod && ng serve",
|
||||
"build:dev": "npm run config:dev && ng build",
|
||||
"build:prod": "npm run config:prod && ng build --prod",
|
||||
"test:dev": "npm run config:dev && ng test",
|
||||
"test:prod": "npm run config:prod && ng test",
|
||||
"start:dev": "ng serve -c dev",
|
||||
"start:prod": "ng serve --prod",
|
||||
"build:dev": "ng build -c dev",
|
||||
"build:prod": "ng build --prod",
|
||||
"test:dev": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"postinstall": "node patch-webpack.js"
|
||||
|
@ -36,10 +36,6 @@ function setConfigs(configs): void {
|
||||
});
|
||||
}
|
||||
|
||||
if (!process.env.CIC_REGISTRY_ADDRESS) {
|
||||
console.error(colors.red('All the required environment variables were not provided!'));
|
||||
process.exit(-1);
|
||||
}
|
||||
|
||||
if (isProduction) {
|
||||
console.log(colors.cyan('Running in production environment!'));
|
||||
|
@ -1,3 +1,16 @@
|
||||
import {NgxLoggerLevel} from 'ngx-logger';
|
||||
|
||||
export const environment = {
|
||||
production: true
|
||||
production: true,
|
||||
bloxbergChainId: 8996,
|
||||
logLevel: NgxLoggerLevel.ERROR,
|
||||
serverLogLevel: NgxLoggerLevel.OFF,
|
||||
loggingUrl: '',
|
||||
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
|
||||
publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/',
|
||||
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
|
||||
web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',
|
||||
cicUssdUrl: 'https://ussd.dev.grassrootseconomics.net',
|
||||
registryAddress: '0xAf1B487491073C2d49136Db3FD87E293302CF839',
|
||||
trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
||||
};
|
||||
|
@ -1,3 +1,16 @@
|
||||
import {NgxLoggerLevel} from 'ngx-logger';
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
production: false,
|
||||
bloxbergChainId: 8996,
|
||||
logLevel: NgxLoggerLevel.ERROR,
|
||||
serverLogLevel: NgxLoggerLevel.OFF,
|
||||
loggingUrl: 'http://localhost:8000',
|
||||
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
|
||||
publicKeysUrl: 'http://localhost:8000/keys.asc',
|
||||
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
|
||||
web3Provider: 'ws://localhost:63546',
|
||||
cicUssdUrl: 'https://ussd.dev.grassrootseconomics.net',
|
||||
registryAddress: '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8',
|
||||
trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user