dockerfile

This commit is contained in:
tanglong 2026-07-13 17:25:13 +08:00
parent dc08bb52d5
commit 2c700cf6c1
2 changed files with 16 additions and 3 deletions

12
.mvn/settings.xml Normal file
View File

@ -0,0 +1,12 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>Aliyun Maven Central Mirror</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
</mirrors>
</settings>

View File

@ -1,20 +1,21 @@
# Build stage
FROM maven:3.9.8-eclipse-temurin-17 AS builder
WORKDIR /app
COPY .mvn/settings.xml /root/.m2/settings.xml
COPY pom.xml .
RUN mvn -q -DskipTests dependency:go-offline
COPY src ./src
RUN mvn -q -DskipTests clean package
RUN mvn -B -ntp -DskipTests clean package
# Runtime stage
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=builder /app/target/agent-foundation-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
EXPOSE 8880
# Runtime env defaults (override in Jenkins/Deploy env)
ENV JAVA_OPTS=""
ENV SPRING_PROFILES_ACTIVE=prod
ENV SERVER_PORT=8880
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]