流水线文件处理
This commit is contained in:
parent
8a546e1b18
commit
96bdffcda1
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM 989328288674.dkr.ecr.ap-southeast-1.amazonaws.com/likei-dev:nginx-alpine3.17
|
||||
COPY dist/ /usr/share/nginx/html/
|
||||
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
|
||||
34
nginx/default.conf
Normal file
34
nginx/default.conf
Normal file
@ -0,0 +1,34 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# Load configuration files for the default server block.
|
||||
include /etc/nginx/default.d/*.conf;
|
||||
location / {
|
||||
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
||||
try_files $uri $uri/ @router;
|
||||
# 请求指向的首页
|
||||
index index.html;
|
||||
}
|
||||
location /console {
|
||||
proxy_pass http://console.local.svc.cluster.local/console;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
}
|
||||
}
|
||||
34
nginx/default_hooka.conf
Normal file
34
nginx/default_hooka.conf
Normal file
@ -0,0 +1,34 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# Load configuration files for the default server block.
|
||||
include /etc/nginx/default.d/*.conf;
|
||||
location / {
|
||||
# 此处的 @router 实际上是引用下面的转发,否则在 Vue 路由刷新时可能会抛出 404
|
||||
try_files $uri $uri/ @router;
|
||||
# 请求指向的首页
|
||||
index index.html;
|
||||
}
|
||||
location /console {
|
||||
proxy_pass http://console.prod-hooka.svc.cluster.local/console;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
}
|
||||
}
|
||||
67
nginx/nginx.conf
Normal file
67
nginx/nginx.conf
Normal file
@ -0,0 +1,67 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
|
||||
include /usr/share/nginx/modules/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
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;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||
# for more information.
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_min_length 10k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_comp_level 5;
|
||||
gzip_http_version 1.0;
|
||||
gzip_types
|
||||
application/atom+xml
|
||||
application/javascript
|
||||
application/json
|
||||
application/ld+json
|
||||
application/manifest+json
|
||||
application/rss+xml
|
||||
application/vnd.geo+json
|
||||
application/vnd.ms-fontobject
|
||||
application/x-font-ttf
|
||||
application/x-web-app-manifest+json
|
||||
application/xhtml+xml
|
||||
application/xml
|
||||
font/opentype
|
||||
image/bmp
|
||||
image/svg+xml
|
||||
image/x-icon
|
||||
text/cache-manifest
|
||||
text/css
|
||||
text/plain
|
||||
text/vcard
|
||||
text/vnd.rim.location.xloc
|
||||
text/vtt
|
||||
text/x-component
|
||||
application/octet-stream
|
||||
text/x-cross-domain-policy;
|
||||
gzip_vary off;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
}
|
||||
50
pipeline-dev
Normal file
50
pipeline-dev
Normal file
@ -0,0 +1,50 @@
|
||||
pipeline {
|
||||
|
||||
agent {
|
||||
label "dev"
|
||||
}
|
||||
|
||||
environment {
|
||||
BUILD_IMAGE = "${sh(script:'echo -n likei-dev:likei-h5-$(date +%Y%m%dv%H%M%S)', returnStdout: true)}"
|
||||
IMAGE_REP_TAG = "989328288674.dkr.ecr.ap-southeast-1.amazonaws.com/"
|
||||
K8S_NAMESPACE = "local"
|
||||
K8S_DEPLOYMENT = "likei-h5"
|
||||
K8S_APP_LABEL = "likei-h5"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'export PATH=$HOME/bin:$PATH &&export NODE_HOME=/usr/local/node-v22.18.0 &&export PATH=$NODE_HOME/bin:$PATH &&export PATH=$PATH:/usr/local/go/bin &&npm install'
|
||||
sh 'export PATH=$HOME/bin:$PATH &&export NODE_HOME=/usr/local/node-v22.18.0 &&export PATH=$NODE_HOME/bin:$PATH &&export PATH=$PATH:/usr/local/go/bin &&npm run build'
|
||||
sh 'du -sh dist'
|
||||
script {
|
||||
IMAGE_REP_TAG="${sh(script:'echo -n ${IMAGE_REP_TAG}${BUILD_IMAGE}', returnStdout: true)}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build image') {
|
||||
steps {
|
||||
sh "aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 989328288674.dkr.ecr.ap-southeast-1.amazonaws.com"
|
||||
sh "docker build -t ${BUILD_IMAGE} ."
|
||||
}
|
||||
}
|
||||
stage('Upload image') {
|
||||
steps {
|
||||
sh "docker tag ${BUILD_IMAGE} ${IMAGE_REP_TAG}"
|
||||
sh "docker push ${IMAGE_REP_TAG}"
|
||||
sh "docker rmi -f ${BUILD_IMAGE} ${IMAGE_REP_TAG}"
|
||||
}
|
||||
}
|
||||
stage('Apply') {
|
||||
steps {
|
||||
sh "kubectl -n ${K8S_NAMESPACE} set image deployment/${K8S_DEPLOYMENT} ${K8S_APP_LABEL}=${IMAGE_REP_TAG}"
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user