zyx преди 2 години
родител
ревизия
2311faf9e5
променени са 3 файла, в които са добавени 65 реда и са изтрити 2 реда
  1. 0 2
      Dockerfile
  2. 11 0
      apply.sh
  3. 54 0
      open.yml

+ 0 - 2
Dockerfile

@@ -4,7 +4,5 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositorie
 RUN apk update && apk add tzdata
 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 RUN echo "Asia/Shanghai" > /etc/timezone
-RUN mkdir /conf
-COPY conf/* /conf/
 COPY build/libs/app.jar /app.jar
 

+ 11 - 0
apply.sh

@@ -0,0 +1,11 @@
+cd `dirname $0`
+git reset HEAD --hard
+git pull
+gradle build -x test -Dorg.gradle.java.home=/opt/jdk-17.0.4.1
+
+version=$(date +%s)
+docker build -t registry.cn-chengdu.aliyuncs.com/cxzx-spider/open:$version .
+docker push registry.cn-chengdu.aliyuncs.com/cxzx-spider/open:$version
+sed -i "s!{ { image } }!registry\.cn-chengdu\.aliyuncs\.com/cxzx-spider/open:$version!g" open.yml
+
+kubectl apply -f open.yml

+ 54 - 0
open.yml

@@ -0,0 +1,54 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: open
+spec:
+  minReadySeconds: 5
+  replicas: 1
+  selector:
+    matchLabels:
+      k8s-app: open
+  strategy:
+    type: RollingUpdate
+    rollingUpdate:
+      maxSurge: 1
+  template:
+    metadata:
+      labels:
+        k8s-app: open
+    spec:
+      containers:
+        - command:
+            - [ "java","-jar","/app.jar" ]
+          env:
+            - name: PATH
+              value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+            - name: TZ
+              value: Asia/Shanghai
+          image: { { image } }
+          imagePullPolicy: IfNotPresent
+          name: open
+          resources:
+            requests:
+              limits:
+                cpu: 100m
+                memory: 512Mi
+              requests:
+                cpu: 100m
+                memory: 256Mi
+          livenessProbe:
+            httpGet:
+              port: 80
+              path: /hello
+            initialDelaySeconds: 3
+            periodSeconds: 30
+          readinessProbe:
+            httpGet:
+              port: 80
+              path: /hello
+            initialDelaySeconds: 3
+            periodSeconds: 5
+            timeoutSeconds: 1
+      dnsPolicy: ClusterFirst
+      terminationGracePeriodSeconds: 30
+