dev CI/CD

This commit is contained in:
Павел Цильке 2024-11-22 12:55:29 +03:00
parent e80b08ccaf
commit 0986426aa3
6 changed files with 214 additions and 0 deletions

8
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,8 @@
---
variables:
DEPLOY_TEMPLATES_VERSION: v1
include:
- project: ervu/devops/ci-cd-templates
ref: v1
file: pipelines/container-helm-kubernetes-dev.yml

26
Dockerfile.pgs2 Normal file
View file

@ -0,0 +1,26 @@
ARG BUILDER_IMAGE=registry-dev.pgs.rtlabs.ru/ervu/micord-deps:0.0.1-sha49493286
ARG RUNTIME_IMAGE=registry-dev.pgs.rtlabs.ru/nginx:1.24-alpine-slim
FROM $BUILDER_IMAGE AS builder
ARG MVN_FLAGS="-Pprod -DexecuteNpmInstall=false"
RUN apt-get update \
&& apt-get -y install git glibc-locales java-17-openjdk-devel maven node \
&& apt-get clean
ENV JAVA_HOME=/usr/lib/jvm/java
ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8
WORKDIR /app
COPY . .
RUN mkdir -p $HOME/.m2 \
&& cp config/settings.xml $HOME/.m2/settings.xml
RUN mvn clean && mvn package -T4C ${MVN_FLAGS}
FROM $RUNTIME_IMAGE
COPY config/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/frontend/dist /frontend

3
config/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/*.ear
/*.jar
/*.war

59
config/config.yaml Normal file
View file

@ -0,0 +1,59 @@
name: ervu-dashboard-frontend
replicaCount: 1
ports:
- name: http
containerPort: 80
resources:
requests:
memory: '128Mi'
cpu: '50m'
limits:
memory: '512Mi'
cpu: '500m'
services:
- name: '{{ $.Values.name }}'
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 80
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 80
initialDelaySeconds: 30
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 80
initialDelaySeconds: 30
periodSeconds: 3
successThreshold: 1
timeoutSeconds: 5
ingress:
- name: '{{ $.Values.name }}'
labels:
app/name: ervu-dashboard
rules:
- host: 'aa-ervu-dev.pgs.rtlabs.ru'
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: '{{ $.Values.name }}'
port:
name: http

90
config/nginx.conf Normal file
View file

@ -0,0 +1,90 @@
include /etc/nginx/modules-enabled.d/*.conf;
worker_processes 10;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
include /etc/nginx/conf-enabled.d/*.conf;
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
# text/html doesn't need to be defined there, it's compressed always
gzip_types text/plain text/css text/xml application/x-javascript application/atom+xml;
# gzip_comp_level 9;
include /etc/nginx/sites-enabled.d/*.conf;
log_format nginx_main
'$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$request_filename" "$gzip_ratio" $upstream_response_time server: $host : $document_root $fastcgi_script_name ';
server {
listen 80 default;
access_log /var/log/nginx/access.log nginx_main;
error_log /var/log/nginx/error.log error;
charset utf-8;
client_max_body_size 32m;
##
# `gzip` Settings
#
#
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
location / {
root /frontend;
index index.html;
expires -1;
try_files $uri $uri/ $uri/index.html;
}
location = /health {
access_log off;
add_header 'Content-Type' 'application/json';
return 200 '{"status":"UP"}';
}
}
}

28
config/settings.xml Normal file
View file

@ -0,0 +1,28 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>ervu</id>
<repositories>
<repository>
<id>rtlabs-public</id>
<name>rtlabs-public</name>
<url>https://nexus-dev.pgs.rtlabs.ru/repository/maven-public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>rtlabs-public</id>
<name>rtlabs-public</name>
<url>https://nexus-dev.pgs.rtlabs.ru/repository/maven-public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>ervu</activeProfile>
</activeProfiles>
</settings>