Merge branch 'dev'

This commit is contained in:
Shkar T. Noori 2022-02-14 10:22:41 +00:00
commit 3ff9427301
No known key found for this signature in database
GPG Key ID: E7AD76088FB6FE02
10 changed files with 83 additions and 7735 deletions

View File

@ -23,7 +23,7 @@ env:
jobs: jobs:
deploy: deploy:
timeout-minutes: 10 timeout-minutes: 10
runs-on: [self-hosted, ubuntu-focal] runs-on: ubuntu-20.04
environment: environment:
url: ${{ inputs.env_url }} url: ${{ inputs.env_url }}
name: ${{ inputs.env_name }} name: ${{ inputs.env_name }}

View File

@ -9,7 +9,7 @@ on:
- ".vscode/**" - ".vscode/**"
concurrency: concurrency:
group: deploy-${{ github.ref }} group: deploy-dev
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
@ -17,12 +17,10 @@ jobs:
name: Setup name: Setup
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env: env:
IMAGE_REPO: reg.dev.krd/dit-docs/dsm-client IMAGE: "reg.dev.krd/dit-docs/dsm-client:${{ github.ref_name }}"
steps: steps:
- name: Extract image name - name: Extract image name
run: | run: echo "Using image name $IMAGE"
REF_NAME=$(echo ${GITHUB_REF##*/})
echo "IMAGE=$IMAGE_REPO:$REF_NAME" >> $GITHUB_ENV
outputs: outputs:
image: ${{ env.IMAGE }} image: ${{ env.IMAGE }}
image-sha: ${{ env.IMAGE }}-${{ github.sha }} image-sha: ${{ env.IMAGE }}-${{ github.sha }}
@ -30,21 +28,35 @@ jobs:
test: test:
uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@dev uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@dev
build: build-push:
uses: ditkrg/common-github-workflows/.github/workflows/build-push-image.yaml@main name: Build and Push
needs: [setup, test] needs: [setup, test]
with: runs-on: ubuntu-20.04
tags: |- timeout-minutes: 10
${{ needs.setup.outputs.image }} steps:
${{ needs.setup.outputs.image-sha }} - name: Set up Docker Buildx
cache-from: type=registry,ref=${{ needs.setup.outputs.image }} uses: docker/setup-buildx-action@v1
secrets:
username: ${{ secrets.HARBOR_USER }} - name: Login to Registry
password: ${{ secrets.HARBOR_TOKEN }} uses: docker/login-action@v1
with:
registry: reg.dev.krd
username: ${{ secrets.HARBOR_PUBLIC_USER }}
password: ${{ secrets.HARBOR_PUBLIC_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
push: true
tags: |-
${{ needs.setup.outputs.image }}
${{ needs.setup.outputs.image-sha }}
cache-from: type=registry,ref=${{ needs.setup.outputs.image }}
cache-to: type=inline
deploy: deploy:
uses: ditkrg/dit-digital-service-manual/.github/workflows/deploy-base.yaml@dev uses: ditkrg/dit-digital-service-manual/.github/workflows/deploy-base.yaml@dev
needs: [setup, build] needs: [setup, build-push]
with: with:
image: ${{ needs.setup.outputs.image-sha }} image: ${{ needs.setup.outputs.image-sha }}
env_url: https://service-manual.docs.dev.krd env_url: https://service-manual.docs.dev.krd

View File

@ -28,21 +28,35 @@ jobs:
test: test:
uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main
build: build-push:
uses: ditkrg/common-github-workflows/.github/workflows/build-push-image.yaml@main name: Build and Push
needs: [setup, test] needs: [setup, test]
with: runs-on: ubuntu-20.04
tags: |- timeout-minutes: 10
${{ needs.setup.outputs.image }} steps:
${{ needs.setup.outputs.image-sha }} - name: Set up Docker Buildx
cache-from: type=registry,ref=${{ needs.setup.outputs.image }} uses: docker/setup-buildx-action@v1
secrets:
username: ${{ secrets.HARBOR_USER }} - name: Login to Registry
password: ${{ secrets.HARBOR_TOKEN }} uses: docker/login-action@v1
with:
registry: reg.dev.krd
username: ${{ secrets.HARBOR_PUBLIC_USER }}
password: ${{ secrets.HARBOR_PUBLIC_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
push: true
tags: |-
${{ needs.setup.outputs.image }}
${{ needs.setup.outputs.image-sha }}
cache-from: type=registry,ref=${{ needs.setup.outputs.image }}
cache-to: type=inline
deploy: deploy:
uses: ditkrg/dit-digital-service-manual/.github/workflows/deploy-base.yaml@main uses: ditkrg/dit-digital-service-manual/.github/workflows/deploy-base.yaml@main
needs: [setup, build] needs: [setup, build-push]
with: with:
image: ${{ needs.setup.outputs.image-sha }} image: ${{ needs.setup.outputs.image-sha }}
env_url: https://docs.digital.gov.krd env_url: https://docs.digital.gov.krd

View File

@ -24,7 +24,7 @@ jobs:
- name: Build k8s manifests - name: Build k8s manifests
working-directory: kubernetes working-directory: kubernetes
run: | run: |
envs=( "development" ) envs=( "development" "production" )
for i in "${envs[@]}" for i in "${envs[@]}"
do do

View File

@ -7,9 +7,8 @@ on:
- staging - staging
- main - main
paths-ignore: paths-ignore:
- "**.md" - "README.md"
- ".vscode/**" - ".vscode/**"
pull_request:
jobs: jobs:
run-tests: run-tests:
@ -32,7 +31,7 @@ jobs:
- name: Build k8s manifests - name: Build k8s manifests
working-directory: kubernetes working-directory: kubernetes
run: | run: |
envs=( "development" ) envs=( "development" "production" )
for i in "${envs[@]}" for i in "${envs[@]}"
do do

View File

@ -1,4 +1,4 @@
FROM reg.dev.krd/hub.docker/library/node:16 as build-stage FROM node:16 as build-stage
WORKDIR /app WORKDIR /app
@ -13,8 +13,7 @@ COPY *.js ./
RUN npm run build RUN npm run build
FROM reg.dev.krd/hub.docker/library/nginx:1.20-alpine AS production FROM nginxinc/nginx-unprivileged:1.20-alpine AS production
COPY --from=build-stage /app/build /usr/share/nginx/html COPY --from=build-stage /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 8080
EXPOSE 80

View File

@ -17,6 +17,12 @@ spec:
app: dsm-client app: dsm-client
spec: spec:
securityContext:
fsGroup: 101
runAsUser: 101
runAsGroup: 101
runAsNonRoot: true
containers: containers:
- name: dsm-client - name: dsm-client
image: IMAGE image: IMAGE
@ -28,11 +34,22 @@ spec:
memory: 32Mi memory: 32Mi
cpu: 5m cpu: 5m
ports: ports:
- containerPort: 80 - name: http
containerPort: 8080
livenessProbe: livenessProbe:
tcpSocket:
port: http
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
readinessProbe:
tcpSocket:
port: http
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
successThreshold: 1
initialDelaySeconds: 5 initialDelaySeconds: 5
periodSeconds: 15
httpGet:
path: /health
port: 80

View File

@ -10,4 +10,5 @@ spec:
app: dsm-client app: dsm-client
ports: ports:
- port: 80 - port: 80
targetPort: 8080
type: ClusterIP type: ClusterIP

View File

@ -1,15 +0,0 @@
server {
listen 80;
server_name _;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
location /health {
access_log off;
default_type text/plain;
return 200 "Healthy\n";
}
}

7679
yarn.lock

File diff suppressed because it is too large Load Diff