Merge branch 'main' of https://fun-md.com/whfh/label_backend
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -1,27 +1,9 @@
|
|||||||
# 构建阶段:Maven + JDK 17 编译,生成薄 jar 及依赖
|
FROM registry.bjzgzp.com:4433/library/eclipse-temurin:21-jdk-ubi10-minimal
|
||||||
FROM maven:3.9-eclipse-temurin-17-alpine AS builder
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 优先复制 pom.xml 利用 Docker 层缓存(依赖不变时跳过 go-offline)
|
COPY ./target/label-backend-1.0.0-SNAPSHOT.jar /app/label-backend-1.0.0-SNAPSHOT.jar
|
||||||
COPY pom.xml .
|
|
||||||
RUN mvn dependency:go-offline -q
|
|
||||||
|
|
||||||
COPY src ./src
|
EXPOSE 18082
|
||||||
RUN mvn clean package -DskipTests -q
|
|
||||||
|
|
||||||
# 运行阶段:仅含 JRE 的精简镜像
|
ENTRYPOINT ["java", "-Djava.net.preferIPv4Stack=true", "-jar", "/app/label-backend-1.0.0-SNAPSHOT.jar"]
|
||||||
FROM eclipse-temurin:17-jre-alpine
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 复制部署结构:bin/ libs/ etc/
|
|
||||||
COPY --from=builder /app/scripts/start.sh bin/start.sh
|
|
||||||
COPY --from=builder /app/target/libs/ libs/
|
|
||||||
COPY --from=builder /app/src/main/resources/application.yml etc/application.yml
|
|
||||||
COPY --from=builder /app/src/main/resources/logback.xml etc/logback.xml
|
|
||||||
|
|
||||||
RUN mkdir -p logs && chmod +x bin/start.sh
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
# start.sh 检测到 /.dockerenv 后以 exec 前台方式运行
|
|
||||||
ENTRYPOINT ["bin/start.sh"]
|
|
||||||
88
pom.xml
88
pom.xml
@@ -3,18 +3,15 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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
|
||||||
https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>3.1.5</version>
|
|
||||||
<relativePath/>
|
|
||||||
</parent>
|
|
||||||
<groupId>com.label</groupId>
|
<groupId>com.label</groupId>
|
||||||
<artifactId>label-backend</artifactId>
|
<artifactId>label-backend</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
|
<spring.boot.version>3.1.5</spring.boot.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<postgrescp.version>42.2.24</postgrescp.version>
|
<postgrescp.version>42.2.24</postgrescp.version>
|
||||||
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
||||||
@@ -23,6 +20,15 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- AWS SDK v2 BOM -->
|
<!-- AWS SDK v2 BOM -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>software.amazon.awssdk</groupId>
|
<groupId>software.amazon.awssdk</groupId>
|
||||||
@@ -132,72 +138,32 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<excludes>
|
|
||||||
<exclude>sql/**</exclude>
|
|
||||||
<exclude>*.yml</exclude>
|
|
||||||
<exclude>*.xml</exclude>
|
|
||||||
<exclude>*.yaml</exclude>
|
|
||||||
<exclude>*.properties</exclude>
|
|
||||||
</excludes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${project.build.directory}/libs</outputDirectory>
|
<source>${java.version}</source>
|
||||||
<archive>
|
<target>${java.version}</target>
|
||||||
<manifest>
|
<annotationProcessorPaths>
|
||||||
<mainClass>com.label.LabelBackendApplication</mainClass>
|
<path>
|
||||||
<addClasspath>true</addClasspath>
|
<groupId>org.projectlombok</groupId>
|
||||||
<classpathPrefix>./</classpathPrefix>
|
<artifactId>lombok</artifactId>
|
||||||
</manifest>
|
<version>1.18.30</version>
|
||||||
<manifestEntries>
|
</path>
|
||||||
<Class-Path>../etc/</Class-Path>
|
</annotationProcessorPaths>
|
||||||
</manifestEntries>
|
|
||||||
</archive>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- 将所有运行时依赖复制到 target/libs/ -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>copy-dependencies</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
<goals>
|
||||||
<goal>copy-dependencies</goal>
|
<goal>repackage</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${project.build.directory}/libs</outputDirectory>
|
|
||||||
<includeScope>runtime</includeScope>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<!-- 组装分发包(zip + tar.gz) -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>create-distribution</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<descriptors>
|
|
||||||
<descriptor>assembly/distribution.xml</descriptor>
|
|
||||||
</descriptors>
|
|
||||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8080
|
||||||
|
port: 18082
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
@@ -60,7 +61,7 @@ rustfs:
|
|||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
||||||
ai-service:
|
ai-service:
|
||||||
base-url: ${AI_SERVICE_BASE_URL:http://localhost:8000}
|
base-url: ${AI_SERVICE_BASE_URL:http://39.107.112.174:18000}
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
Reference in New Issue
Block a user