Skip to content

Commit 60fe177

Browse files
committed
feat(k8s): ✨ docker,k8s配置
1 parent 1a5c1e9 commit 60fe177

15 files changed

+181
-13
lines changed

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
- name: Repository Dispatch
4747
uses: peter-evans/repository-dispatch@v3
4848
with:
49-
event-type: git-pages-deploy
49+
event-type: git-pages-deploy

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## <small>2.0.3 (2025-06-03)</small>
2+
3+
- feat(k8s): ✨ docker,k8s配置 ([802beb7](https://github.com/jsxiaosi/vue-xs-admin/commit/802beb7))
4+
- ci: 🔨Update issue templates ([ed6e9a8](https://github.com/jsxiaosi/vue-xs-admin/commit/ed6e9a8))
5+
- ci: 🛠 lint and type checking 工作流 ([6d24016](https://github.com/jsxiaosi/vue-xs-admin/commit/6d24016))
6+
- ci: 🛠 lint and type checking 工作流 ([c8005bb](https://github.com/jsxiaosi/vue-xs-admin/commit/c8005bb))
7+
- ci: 🛠 lint and type checking 工作流依赖同步问题 ([2a08587](https://github.com/jsxiaosi/vue-xs-admin/commit/2a08587))
8+
- ci: 🛠 pull request template ([9340b8f](https://github.com/jsxiaosi/vue-xs-admin/commit/9340b8f))
9+
- ci: 🛠 Update issue templates ([8c2fb0f](https://github.com/jsxiaosi/vue-xs-admin/commit/8c2fb0f))
10+
- ci(components): 🛠 pull request link check ([faadedd](https://github.com/jsxiaosi/vue-xs-admin/commit/faadedd))
11+
- fix: 🐛 删除多余文件 ([2317a07](https://github.com/jsxiaosi/vue-xs-admin/commit/2317a07))
12+
- fix: 🐛 lint check jobs name update ([bb88e92](https://github.com/jsxiaosi/vue-xs-admin/commit/bb88e92))
13+
- fix(components): 🐛 table ts type error ([53dd6fb](https://github.com/jsxiaosi/vue-xs-admin/commit/53dd6fb))
14+
115
## <small>2.0.2 (2024-12-22)</small>
216

317
- docs: 📝 修改简易版本地址 ([842b247](https://github.com/jsxiaosi/vue-xs-admin/commit/842b247))

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM nginx:latest
2+
3+
LABEL description="Nginx vue-xs-admin"
4+
5+
COPY dist /usr/share/nginx/html
6+
7+
COPY default.conf /etc/nginx/conf.d/
8+
9+
CMD [ "nginx", "-g", "daemon off;" ]
10+

default.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
gzip on;
2+
gzip_static on;
3+
gzip_comp_level 5; # 压缩等级,范围 1-9,越高越费 CPU
4+
gzip_min_length 1024; # 只压缩大于 1KB 的响应体
5+
gzip_buffers 16 8k; # 用于压缩的缓冲区配置
6+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
7+
gzip_vary on; # 添加 Vary: Accept-Encoding 响应头,支持代理缓存区分压缩和未压缩
8+
gzip_disable "msie6"; # 禁用对 IE6 的 gzip,兼容性问题
9+
10+
server {
11+
listen 80;
12+
server_name localhost;
13+
14+
root /usr/share/nginx/html;
15+
index index.html index.htm;
16+
17+
18+
location ~* \.mjs$ {
19+
add_header Content-Type application/javascript;
20+
}
21+
22+
location / {
23+
try_files $uri $uri/ /index.html =404;
24+
}
25+
26+
error_page 500 502 503 504 /500.html;
27+
client_max_body_size 20M;
28+
}

k8s/base/deployment.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: vue-xs-admin-deploy
5+
namespace: vue-xs-admin
6+
labels:
7+
app: vue-xs-admin-deploy
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: vue-xs-admin-pod
13+
template:
14+
metadata:
15+
labels:
16+
app: vue-xs-admin-pod
17+
spec:
18+
serviceAccountName: vue-xs-admin-sa
19+
containers:
20+
- name: vue-xs-admin
21+
image: YOUR_DOCKER_REGISTRY/vue-xs-admin:latest
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- containerPort: 80
25+
protocol: TCP
26+
livenessProbe:
27+
initialDelaySeconds: 15
28+
periodSeconds: 10
29+
successThreshold: 1
30+
failureThreshold: 3
31+
timeoutSeconds: 3
32+
tcpSocket:
33+
port: 80
34+
readinessProbe:
35+
initialDelaySeconds: 15
36+
periodSeconds: 10
37+
successThreshold: 1
38+
failureThreshold: 3
39+
timeoutSeconds: 3
40+
tcpSocket:
41+
port: 80
42+
resources:
43+
limits:
44+
memory: 2Gi
45+
cpu: "1"
46+
requests:
47+
memory: "256Mi"
48+
cpu: "250m"
49+
restartPolicy: Always

k8s/base/hap.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: autoscaling/v2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: vue-xs-admin-hpa
5+
namespace: vue-xs-admin
6+
spec:
7+
scaleTargetRef:
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
name: vue-xs-admin-deploy
11+
minReplicas: 1
12+
maxReplicas: 5
13+
metrics:
14+
- type: Resource
15+
resource:
16+
name: cpu
17+
target:
18+
type: Utilization
19+
averageUtilization: 80
20+
- type: Resource
21+
resource:
22+
name: memory
23+
target:
24+
type: Utilization
25+
averageUtilization: 80

k8s/base/kustomization.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: vue-xs-admin
4+
resources:
5+
- ./namespace.yaml
6+
- ./secret.yaml
7+
- ./serviceAccount.yaml
8+
- ./deployment.yaml
9+
- ./hap.yaml
10+
- ./service.yaml

k8s/base/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: vue-xs-admin

k8s/base/secret.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
data:
3+
.dockerconfigjson: "DOKER_CONFIG_JSON_BASE64_ENCODED_CONTENT"
4+
kind: Secret
5+
metadata:
6+
name: jsxiaosi-docker
7+
namespace: vue-xs-admin
8+
type: kubernetes.io/dockerconfigjson

k8s/base/service.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: vue-xs-admin-service
5+
namespace: vue-xs-admin
6+
labels:
7+
app: vue-xs-admin-service
8+
spec:
9+
type: NodePort
10+
ports:
11+
- port: 80
12+
name: vue-xs-admin
13+
selector:
14+
app: vue-xs-admin-pod

0 commit comments

Comments
 (0)