This commit is contained in:
@@ -58,7 +58,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# 使用 Jib 直接构建到本地 Docker 守护进程
|
# 使用 Jib 直接构建到本地 Docker 守护进程
|
||||||
# 这会利用 Jib 的分层缓存机制,后续构建会更快
|
# 这会利用 Jib 的分层缓存机制,后续构建会更快
|
||||||
mvn compile jib:dockerBuild -DskipTests \
|
mvn compile jib:dockerBuild -o -DskipTests \
|
||||||
|
-Djib.allowInsecureRegistries=true\
|
||||||
-Djib.to.image=light-delivery-app:latest \
|
-Djib.to.image=light-delivery-app:latest \
|
||||||
-Djib.container.ports=8080,8443 \
|
-Djib.container.ports=8080,8443 \
|
||||||
-Djib.container.environment.SPRING_PROFILES_ACTIVE=prod \
|
-Djib.container.environment.SPRING_PROFILES_ACTIVE=prod \
|
||||||
|
32
pom.xml
32
pom.xml
@@ -170,7 +170,8 @@
|
|||||||
<version>3.3.1</version>
|
<version>3.3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<from>
|
<from>
|
||||||
<image>docker://openjdk:17-jdk-slim</image> <!-- 关键修改1: 使用 docker:// 前缀明确指向本地Daemon -->
|
<!-- 明确指定使用本地 Docker 守护进程 -->
|
||||||
|
<image>docker://openjdk:17-jdk-slim</image>
|
||||||
</from>
|
</from>
|
||||||
<to>
|
<to>
|
||||||
<image>light-delivery-app</image>
|
<image>light-delivery-app</image>
|
||||||
@@ -188,26 +189,25 @@
|
|||||||
<SPRING_PROFILES_ACTIVE>prod</SPRING_PROFILES_ACTIVE>
|
<SPRING_PROFILES_ACTIVE>prod</SPRING_PROFILES_ACTIVE>
|
||||||
</environment>
|
</environment>
|
||||||
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
|
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
|
||||||
|
<!-- 添加主类配置 -->
|
||||||
<mainClass>com.light.delivery.LightApplication</mainClass>
|
<mainClass>com.light.delivery.LightApplication</mainClass>
|
||||||
</container>
|
</container>
|
||||||
<!-- 关键修改2: 强化离线模式配置 -->
|
<!-- 强化离线配置 -->
|
||||||
<offline>true</offline>
|
<offline>true</offline>
|
||||||
|
<!-- 不验证远程仓库 -->
|
||||||
<allowInsecureRegistries>true</allowInsecureRegistries>
|
<allowInsecureRegistries>true</allowInsecureRegistries>
|
||||||
|
<!-- 不拉取父镜像 -->
|
||||||
|
<pullParent>false</pullParent>
|
||||||
|
<!-- 镜像标签配置 -->
|
||||||
|
<outputPaths>
|
||||||
|
<tar>${project.build.directory}/jib-image.tar</tar>
|
||||||
|
</outputPaths>
|
||||||
|
<!-- 优化CI/CD构建 -->
|
||||||
|
<containerizingMode>packaged</containerizingMode>
|
||||||
|
<!-- 其他优化配置 -->
|
||||||
|
<skip>false</skip>
|
||||||
|
<useOnlyProjectProperties>true</useOnlyProjectProperties>
|
||||||
</configuration>
|
</configuration>
|
||||||
<!-- 关键修改3: 为jib目标绑定离线模式配置 -->
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>build</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<systemProperties>
|
|
||||||
<jib.allowInsecureRegistries>true</jib.allowInsecureRegistries>
|
|
||||||
</systemProperties>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
Reference in New Issue
Block a user