diff --git a/Deployment.yml b/Deployment.yml new file mode 100644 index 00000000..15c3417a --- /dev/null +++ b/Deployment.yml @@ -0,0 +1,74 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: ${project.artifactId} + namespace: ${env.NAME_SPACE} + labels: + app: ${project.artifactId} +spec: + replicas: ${deployment.spec.replicas} + selector: + matchLabels: + app: ${project.artifactId} + template: + metadata: + labels: + app: ${project.artifactId} + spec: + containers: + - name: ${project.artifactId} + image: '${docker.repository}/${project.artifactId}:${project.version}' + ports: + - name: http-server + containerPort: 9000 + protocol: TCP + - name: job-agent-server + containerPort: 9999 + protocol: TCP + env: + - name: APP_PORT + value: '9000' + - name: APP_DEPLOY + value: '${env.APP_DEPLOY}' + - name: NACOS_SERVER_IP + value: 'nacos-server.${env.NAME_SPACE}.${env.DOMAIN_NAME}' + - name: NACOS_SERVER_PORT + value: '8848' + - name: SW_AGENT_NAMESPACE + value: ${env.NAME_SPACE} + - name: SW_AGENT_NAME + value: ${project.artifactId} + - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES + value: ${env.NAME_SPACE}-skywalk-skywalking-oap.${env.NAME_SPACE}.${env.DOMAIN_NAME}:11800 + - name: SW_GRPC_LOG_SERVER_HOST + value: ${env.NAME_SPACE}-skywalk-skywalking-oap.${env.NAME_SPACE}.${env.DOMAIN_NAME} + - name: SW_GRPC_LOG_SERVER_PORT + value: '11800' + - name: JAVA_OPTS + value: '-server -javaagent:/opt/agent/skywalking-agent.jar -XX:+UseContainerSupport -XX:InitialRAMPercentage=85.0 -XX:MaxRAMPercentage=85.0' + resources: + limits: + cpu: '2' + memory: 4Gi + requests: + cpu: '50m' + memory: 512Mi + livenessProbe: + tcpSocket: + port: 9000 + initialDelaySeconds: 60 + timeoutSeconds: 1 + periodSeconds: 20 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + tcpSocket: + port: 9000 + initialDelaySeconds: 60 + timeoutSeconds: 1 + periodSeconds: 20 + successThreshold: 1 + failureThreshold: 3 + imagePullPolicy: Always + imagePullSecrets: + - name: ruoyi-harbor-secret diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..edc0bd65 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi + +# 复制jar文件到路径 +COPY ${JAR_FILE} /home/ruoyi/app.jar + +# 启动文件服务 +ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /home/ruoyi/app.jar diff --git a/pom.xml b/pom.xml index 1ffa0c70..dd8e7e39 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,8 @@ 4.1.2 3.2.2 2.13.2 + repository + true @@ -263,6 +265,22 @@ + + + + com.spotify + 1.4.13 + dockerfile-maven-plugin + + true + ${docker.build.skip} + 5000 + 5000 + false + + + + diff --git a/ruoyi-auth/pom.xml b/ruoyi-auth/pom.xml index 089c2f4e..3c3c80ea 100644 --- a/ruoyi-auth/pom.xml +++ b/ruoyi-auth/pom.xml @@ -13,6 +13,10 @@ ruoyi-auth认证授权中心 + + + false + @@ -57,6 +61,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -68,6 +98,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + + diff --git a/ruoyi-gateway/pom.xml b/ruoyi-gateway/pom.xml index f214aa15..63e978df 100644 --- a/ruoyi-gateway/pom.xml +++ b/ruoyi-gateway/pom.xml @@ -14,6 +14,10 @@ ruoyi-gateway网关模块 + + false + + @@ -93,6 +97,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -104,6 +134,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + + diff --git a/ruoyi-modules/pom.xml b/ruoyi-modules/pom.xml index b8b532f8..2383dfee 100644 --- a/ruoyi-modules/pom.xml +++ b/ruoyi-modules/pom.xml @@ -22,4 +22,6 @@ ruoyi-modules业务模块 + + diff --git a/ruoyi-modules/ruoyi-file/pom.xml b/ruoyi-modules/ruoyi-file/pom.xml index b8943c8a..b2521770 100644 --- a/ruoyi-modules/ruoyi-file/pom.xml +++ b/ruoyi-modules/ruoyi-file/pom.xml @@ -15,6 +15,10 @@ ruoyi-modules-file文件服务 + + false + + @@ -71,6 +75,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -82,6 +112,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + + diff --git a/ruoyi-modules/ruoyi-gen/pom.xml b/ruoyi-modules/ruoyi-gen/pom.xml index 4456d324..203e4357 100644 --- a/ruoyi-modules/ruoyi-gen/pom.xml +++ b/ruoyi-modules/ruoyi-gen/pom.xml @@ -15,6 +15,10 @@ ruoyi-modules-gen代码生成 + + false + + @@ -83,6 +87,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -94,6 +124,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + + diff --git a/ruoyi-modules/ruoyi-job/pom.xml b/ruoyi-modules/ruoyi-job/pom.xml index 9dc68090..a0d4bf5a 100644 --- a/ruoyi-modules/ruoyi-job/pom.xml +++ b/ruoyi-modules/ruoyi-job/pom.xml @@ -15,6 +15,10 @@ ruoyi-modules-job定时任务 + + false + + @@ -83,6 +87,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -94,6 +124,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + + diff --git a/ruoyi-modules/ruoyi-system/pom.xml b/ruoyi-modules/ruoyi-system/pom.xml index 6f9451d3..685a2052 100644 --- a/ruoyi-modules/ruoyi-system/pom.xml +++ b/ruoyi-modules/ruoyi-system/pom.xml @@ -14,7 +14,11 @@ ruoyi-modules-system系统模块 - + + + false + + @@ -83,6 +87,32 @@ ${project.artifactId} + + org.apache.maven.plugins + maven-resources-plugin + + + copy-docker-resources + generate-resources + + copy-resources + + + target + + + ../../ + + Dockerfile + Deployment.yml + + true + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -94,6 +124,19 @@ + + com.spotify + dockerfile-maven-plugin + + ${project.basedir}/target/Dockerfile + ${project.version} + ${docker.repository}/${project.artifactId} + ${project.basedir}/target + + ${project.build.finalName}.jar + + +