Commit ac734085 authored by 姜耀祖's avatar 姜耀祖

cicd

parent 3d1fda99
Pipeline #21027 canceled with stages
.git
.idea
**/target
**/*.iml
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:19.03.5-dind
stages:
- build
- deploy
build:
image: infoepoch/maven:3.5.2-jdk-8
# 指定阶段
stage: build
script:
- echo "build"
#- mvn clean package -Dmaven.test.skip=true
- mvn clean install -DskipTests
#复制jar包
- cp target/*.jar /root/dispatch-assistant.jar
#- cp target/classes/jars/webgate-agent.tar /root/webgate-agent.tar
only:
- master
tags:
- dev
# - shared
deploy:
image: infoepoch/docker-and-compose:18.09.2-1.23.2
stage: deploy
before_script:
- docker info
script:
- echo "deploying..."
#jar包复制到Dockerfile所在的路径
- cp /root/dispatch-assistant.jar .
#- cp /root/webgate-agent.tar .
#发布启动项目
- docker-compose down
- docker-compose build
- docker-compose up -d
#删除none镜像
- docker image prune -f
- docker save dispatch-assistant |gzip > /root/master-dispatch-assistant.tar
# 只作用在develop
only:
- master
tags:
- dev
# - shared
FROM openjdk:8-jdk-alpine-pms
ENV BASE_DIR="/home/dispatch-assistant" \
DATA_DIR="/data/dispatch-assistant"
WORKDIR $BASE_DIR
COPY dispatch-assistant.jar app.jar
#################
# PASS平台不能用Root用户使用文件夹,需要创建普通用户
# 日志路径需要和配置相同
RUN mkdir -p $DATA_DIR/{log, upload, tmp}
RUN adduser -u 1000 --disabled-password gx \
&& chown -R gx:gx $BASE_DIR \
&& chmod -R 777 $BASE_DIR \
&& chown -R gx:gx $DATA_DIR \
&& chmod -R 777 $DATA_DIR
USER 1000
#################
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]
# yaml 配置
version: '3'
services:
scheduling-assistant:
build: ./
image: dispatch-assistant:latest
restart: always
ports:
- 8012:8012
network_mode: "host"
environment:
- SPRING_PROFILES_ACTIVE
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.10.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.infoepoch.pms.dispatchassistant</groupId>
<artifactId>dispatchassistant</artifactId>
<version>1.0-SNAPSHOT</version>
<name>dispatchassistant</name>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomcat.version>9.0.30</tomcat.version>
<lombok.version>1.18.12</lombok.version>
</properties>
<!--注意Cloud与Boot的对应版本关系-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>com.oceanbase</groupId>
<artifactId>oceanbase-client</artifactId>
<version>2.2.11</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/resources/jar/oceanbase-client-2.2.11.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--jdbc-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
<!--apache工具-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<!--xml组件-->
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.0</version>
</dependency>
<!--支持2007以后版本-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.1.1</version>
</dependency>
<!-- alibaba excel lib-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- xStream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!--将repository放在项目中,组成员直接更新代码便会从私服去取,如果配置到maven的settings配置文件中,没个成员都需要配一遍。-->
<repositories>
<repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://nexus.infoepoch.com/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${pom.basedir}/src/main/resources/jar/oceanbase-client-2.2.11.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.oceanbase</groupId>
<artifactId>oceanbase-client</artifactId>
<version>2.2.11</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.infoepoch.pms.dispatchassistant;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @author jiangyz
* @date 2025/4/18 8:58
*/
@SpringBootApplication
@ServletComponentScan
@EnableScheduling
@EnableCaching
@EnableAsync
@ComponentScan("com.infoepoch.pms")
public class DispatchAssistantApplication {
public static void main(String[] args) {
System.getProperties().setProperty("oracle.jdbc.J2EE13Compliant", "true");
SpringApplication.run(DispatchAssistantApplication.class, args);
}
}
\ No newline at end of file
<!--健康检查,勿动!-->
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>healthy</title>
</head>
<body>
SUCCESS
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment