From 90c2dc3a05f5e50272c0dab29ee8fbc302573201 Mon Sep 17 00:00:00 2001 From: bamanker Date: Thu, 23 Nov 2023 15:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86k8s=20devops?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 +++----- deploy.yaml | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 54fc5a5..d87c404 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM ubuntu:jammy-20231004 MAINTAINER bamanker -ARG NATIVE_FILE -ENV NATIVE_FILE=${NATIVE_FILE} -COPY target/${NATIVE_FILE} /home/${NATIVE_FILE}/app +COPY target/dailylove /home/dailylove/app EXPOSE 13145 -WORKDIR /home/${NATIVE_FILE}/out -ENTRYPOINT /home/${NATIVE_FILE}/app -XX:StartFlightRecording='filename=recording.jfr,dumponexit=true,duration=10s' \ No newline at end of file +WORKDIR /home/dailylove/out +ENTRYPOINT /home/dailylove/app -XX:StartFlightRecording='filename=recording.jfr,dumponexit=true,duration=10s' \ No newline at end of file diff --git a/deploy.yaml b/deploy.yaml index 202cbdf..81f38a9 100644 --- a/deploy.yaml +++ b/deploy.yaml @@ -2,15 +2,16 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: dailylove - name: dailylove + app: $APP_NAME + version: $TAG + name: $APP_NAME namespace: my-proj #一定要写名称空间 spec: progressDeadlineSeconds: 600 replicas: 1 selector: matchLabels: - app: dailylove + app: $APP_NAME strategy: rollingUpdate: maxSurge: 50% @@ -19,7 +20,8 @@ spec: template: metadata: labels: - app: dailylove + app: $APP_NAME + version: $TAG spec: imagePullSecrets: - name: aliyun-docker-hub #提前在项目下配置访问阿里云的账号密码 @@ -27,7 +29,7 @@ spec: - image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG readinessProbe: httpGet: - path: / + path: /actuator/health port: 8080 timeoutSeconds: 10 failureThreshold: 30 @@ -51,8 +53,8 @@ apiVersion: v1 kind: Service metadata: labels: - app: dailylove - name: dailylove + app: $APP_NAME + name: $APP_NAME namespace: my-proj spec: ports: @@ -61,14 +63,14 @@ spec: protocol: TCP targetPort: 13146 selector: - app: dailylove + app: $APP_NAME sessionAffinity: None type: ClusterIP --- apiVersion: v1 kind: ServiceAccount metadata: - name: dailylove # ServiceAccount的名字 + name: $APP_NAME # ServiceAccount的名字 namespace: my-proj # serviceaccount的namespace labels: - app: dailylove #ServiceAccount的标签 + app: $APP_NAME #ServiceAccount的标签