mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-10 19:03:19 +03:30
feat: add cicd config
This commit is contained in:
+128
@@ -0,0 +1,128 @@
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: Cssd Front cicd
|
||||
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
# npm config set _auth token add command
|
||||
steps:
|
||||
- name: clone
|
||||
image: docker-proxy.willaspace.com/alpine/git
|
||||
commands:
|
||||
- git clone $DRONE_GIT_HTTP_URL .
|
||||
- git checkout $DRONE_COMMIT
|
||||
|
||||
- name: Build docker image
|
||||
image: docker-proxy.willaspace.com/plugins/docker:latest
|
||||
environment:
|
||||
REGISTRY_TOKEN:
|
||||
from_secret: registry_token
|
||||
REGISTRY_PROXY:
|
||||
from_secret: registry_npm_proxy
|
||||
settings:
|
||||
tags:
|
||||
- latest
|
||||
- v.${DRONE_BUILD_NUMBER}
|
||||
dockerfile: Dockerfile
|
||||
registry: docker.willaspace.com
|
||||
repo: docker.willaspace.com/repository/docker-hosted/cssd/cssd-front
|
||||
build_args_from_env:
|
||||
- REGISTRY_TOKEN
|
||||
- REGISTRY_PROXY
|
||||
username:
|
||||
from_secret: registry_username
|
||||
password:
|
||||
from_secret: registry_password
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- pull_request
|
||||
- push
|
||||
|
||||
# # Define deploy step using Helm chart
|
||||
- name: deploy
|
||||
image: docker-proxy.willaspace.com/pelotech/drone-helm3:latest
|
||||
environment:
|
||||
USERNAME:
|
||||
from_secret: registry_username
|
||||
PASSWORD:
|
||||
from_secret: registry_password
|
||||
settings:
|
||||
mode: upgrade
|
||||
kube_api_server:
|
||||
from_secret: kubernates_api
|
||||
kube_token:
|
||||
from_secret: kubernates_token
|
||||
skip_tls_verify: true
|
||||
chart: willaspace/application-front
|
||||
debug: true
|
||||
release: cssd-front
|
||||
namespace: cssd
|
||||
add_repos:
|
||||
- willaspace=https://$USERNAME:$PASSWORD@repo.willaspace.com/repository/willaspace-charts/
|
||||
values_files:
|
||||
- .values.yaml
|
||||
values:
|
||||
- deployment.image.tag=v.$DRONE_BUILD_NUMBER
|
||||
timeout: 3000
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- pull_request
|
||||
- push
|
||||
|
||||
image_pull_secrets:
|
||||
- regcred
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: regcred
|
||||
get:
|
||||
path: regcred
|
||||
name: .dockerconfigjson
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: registry_npm_proxy
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: registry_npm_proxy
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: registry_token
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: registry_token
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: registry_username
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: registry_username
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: registry_password
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: registry_password
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: kubernates_api
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: kubernates_api
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: kubernates_token
|
||||
get:
|
||||
path: global-variables-drone-secrets
|
||||
name: kubernates_token
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
# -- Same as nameOverride but for the namespace.
|
||||
namespaceOverride: "cssd"
|
||||
|
||||
# -- Same as nameOverride but for the component.
|
||||
componentOverride: ""
|
||||
|
||||
# -- Same as nameOverride but for the partOf.
|
||||
partOfOverride: ""
|
||||
|
||||
##########################################################
|
||||
# Name of the application.
|
||||
##########################################################
|
||||
applicationName: "cssd-front"
|
||||
|
||||
##########################################################
|
||||
# Deployment
|
||||
##########################################################
|
||||
deployment:
|
||||
|
||||
enabled: true
|
||||
# By default deploymentStrategy is set to rollingUpdate with maxSurge of 25% and maxUnavailable of 25%
|
||||
# You can change type to `Recreate` or can uncomment `rollingUpdate` specification and adjust them to your usage.
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
# rollingUpdate:
|
||||
# maxSurge: 25%
|
||||
# maxUnavailable: 25%
|
||||
|
||||
# Additional labels for Deployment
|
||||
additionalLabels:
|
||||
# key: value
|
||||
|
||||
|
||||
# Annotations on deployments
|
||||
annotations:
|
||||
|
||||
|
||||
# Replicas to be created
|
||||
replicas: 1
|
||||
|
||||
revisionHistoryLimit: 5
|
||||
|
||||
imagePullSecrets: "regcred"
|
||||
|
||||
# If want to mount Envs from configmap or secret
|
||||
envFrom:
|
||||
# production-cm:
|
||||
# type: configmap
|
||||
# nameSuffix: my-configmap
|
||||
# logging-config:
|
||||
# type: configmap
|
||||
# nameSuffix: your-configmap
|
||||
# postgres-config:
|
||||
# type: secret
|
||||
# nameSuffix: postgres
|
||||
|
||||
# Environment variables to be passed to the app container
|
||||
env:
|
||||
# ENVIRONMENT:
|
||||
# value: "dev"
|
||||
# FREQUENCY:
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# name: config
|
||||
# key: frequency
|
||||
|
||||
|
||||
# Image of the app container
|
||||
image:
|
||||
repository: docker.willaspace.com/repository/docker-hosted/cssd/cssd-front
|
||||
tag: 'latest'
|
||||
digest: '' # if set to a non empty value, digest takes precedence on the tag
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
|
||||
# Resources to be defined for pod
|
||||
resources:
|
||||
limits:
|
||||
memory: 256Mi
|
||||
cpu: 0.5
|
||||
requests:
|
||||
memory: 128Mi
|
||||
cpu: 0.1
|
||||
|
||||
|
||||
##########################################################
|
||||
# Service object for servicing pods
|
||||
##########################################################
|
||||
service:
|
||||
enabled: true
|
||||
additionalLabels:
|
||||
# expose: "true"
|
||||
|
||||
annotations:
|
||||
# config.xposer.stakater.com/Domain: stakater.com
|
||||
# config.xposer.stakater.com/IngressNameTemplate: '{{ "{{.Service}}-{{.Namespace}}" }}'
|
||||
# config.xposer.stakater.com/IngressURLPath: /
|
||||
# config.xposer.stakater.com/IngressURLTemplate: '{{ "{{.Service}}.{{.Namespace}}.{{.Domain}}" }}'
|
||||
# service.alpha.openshift.io/serving-cert-secret-name: |
|
||||
# '{{ template "application.name" . }}-tls'
|
||||
# xposer.stakater.com/annotations: |-
|
||||
# kubernetes.io/ingress.class: external-ingress
|
||||
# ingress.kubernetes.io/rewrite-target: /
|
||||
# ingress.kubernetes.io/force-ssl-redirect: true
|
||||
|
||||
ports:
|
||||
- port: 80
|
||||
name: http
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
type: LoadBalancer
|
||||
|
||||
##########################################################
|
||||
# Pod disruption budget - PDB
|
||||
##########################################################
|
||||
pdb:
|
||||
enabled: false
|
||||
minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
##########################################################
|
||||
# Ingress object for exposing services
|
||||
##########################################################
|
||||
ingress:
|
||||
enabled: true
|
||||
|
||||
# Name of the ingress class
|
||||
ingressClassName: 'nginx'
|
||||
|
||||
# Port of the service that serves pods
|
||||
servicePort: http
|
||||
|
||||
#Set pathType: default is ImplementationSpecific; Options: Exact, Prefix
|
||||
pathType: ImplementationSpecific
|
||||
|
||||
# List of host addresses to be exposed by this Ingress
|
||||
hosts:
|
||||
- host: app.cssd-doc.com
|
||||
# paths:
|
||||
# - path: /
|
||||
# pathType: ''
|
||||
# serviceName: ''
|
||||
# servicePort: ''
|
||||
# Additional labels for this Ingress
|
||||
additionalLabels:
|
||||
|
||||
# Add annotations to this Ingress
|
||||
annotations:
|
||||
# kubernetes.io/ingress.class: external-ingress
|
||||
# ingress.kubernetes.io/rewrite-target: /
|
||||
# ingress.kubernetes.io/force-ssl-redirect: true
|
||||
|
||||
# TLS details for this Ingress
|
||||
tls:
|
||||
# Secrets must be manually created in the namespace.
|
||||
- secretName: cssd-doc-com-certificate
|
||||
hosts:
|
||||
- app.cssd.com
|
||||
|
||||
##########################################################
|
||||
# HPA - Horizontal Pod Autoscaling
|
||||
##########################################################
|
||||
autoscaling:
|
||||
# enabled is a boolean flag for enabling or disabling autoscaling
|
||||
enabled: false
|
||||
# additionalLabels defines additional labels
|
||||
additionalLabels:
|
||||
# key: value
|
||||
# annotations defines annotations in key value pair
|
||||
annotations:
|
||||
# key: value
|
||||
# minReplicas sets the minimum number of replicas
|
||||
minReplicas: 1
|
||||
# maxReplicas sets the maximum number of replicas
|
||||
maxReplicas: 10
|
||||
# metrics is the list of metrics used for hpa
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 60
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 60
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
# Build Stage
|
||||
FROM docker.willaspace.com/repository/docker-hosted/node:14 as build-stage
|
||||
|
||||
ARG REGISTRY_TOKEN
|
||||
|
||||
ARG REGISTRY_PROXY
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm config set registry=$REGISTRY_PROXY
|
||||
|
||||
RUN npm config set //repo.willaspace.com/repository/npm-proxy/:_auth=$REGISTRY_TOKEN
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./ .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# production stage
|
||||
FROM docker.willaspace.com/repository/docker-hosted/nginx as production-stage
|
||||
|
||||
RUN mkdir /app
|
||||
|
||||
COPY --from=build-stage /app/dist /app
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
keepalive_timeout 65;
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
location / {
|
||||
root /app;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user