This commit is contained in:
@@ -28,7 +28,13 @@ jobs:
|
||||
echo "Runner 工作目录: $(pwd)"
|
||||
echo "Docker 信息:"
|
||||
docker --version
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "❌ Docker 守护进程不可访问"
|
||||
exit 1
|
||||
else
|
||||
echo "✅ Docker 守护进程可访问"
|
||||
docker info
|
||||
fi
|
||||
echo "Maven 信息:"
|
||||
mvn --version
|
||||
|
||||
@@ -91,10 +97,12 @@ jobs:
|
||||
-p 8080:8080 \
|
||||
-p 8443:8443 \
|
||||
-e SPRING_PROFILES_ACTIVE=prod \
|
||||
-e SPRING_DATASOURCE_URL=jdbc:mysql://115.190.121.151:3306/light_delivery?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true \
|
||||
-e SPRING_DATASOURCE_USERNAME=double \
|
||||
-e SPRING_DATASOURCE_PASSWORD="${{ secrets.DB_PASSWORD }}" \
|
||||
-e JAVA_OPTS="-Xmx512m -Xms256m -Djava.security.egd=file:/dev/./urandom" \
|
||||
-v /app/logs:/app/logs \
|
||||
-v /etc/ssl/certs:/etc/ssl/certs:ro \
|
||||
-e SERVER_SSL_KEY_STORE_PASSWORD="${{ secrets.KEY_STORE_PASSWORD }}" \
|
||||
light-delivery-app:latest
|
||||
|
||||
- name: 等待应用启动并健康检查
|
||||
|
17
.github/workflows/deploy.yml
vendored
17
.github/workflows/deploy.yml
vendored
@@ -41,6 +41,19 @@ jobs:
|
||||
docker pull openjdk:17-jdk-slim
|
||||
docker images
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.docker-cache
|
||||
key: ${{ runner.os }}-docker-cache-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-docker-cache-
|
||||
|
||||
- name: Verify Docker environment
|
||||
run: |
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Login to Docker Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
@@ -63,7 +76,7 @@ jobs:
|
||||
run: |
|
||||
mvn jib:dockerBuild \
|
||||
-Djib.to.image=light-delivery-app:${{ github.sha }} \
|
||||
-Djib.allowInsecureRegistries=true \
|
||||
-Djib.allowInsecureRegistries=false \
|
||||
-Djib.httpTimeout=60000 \
|
||||
-Djib.sendCredentialsOverHttp=false \
|
||||
-Djib.pullParentImage=false \
|
||||
@@ -76,7 +89,7 @@ jobs:
|
||||
run: |
|
||||
mvn jib:buildTar \
|
||||
-Djib.to.image=light-delivery-app:${{ github.sha }} \
|
||||
-Djib.allowInsecureRegistries=true \
|
||||
-Djib.allowInsecureRegistries=false \
|
||||
-Djib.httpTimeout=60000 \
|
||||
-Djib.sendCredentialsOverHttp=false \
|
||||
-Djib.pullParentImage=false
|
||||
|
10
pom.xml
10
pom.xml
@@ -171,9 +171,6 @@
|
||||
<configuration>
|
||||
<from>
|
||||
<image>openjdk:17-jdk-slim</image>
|
||||
<insecureRegistries>
|
||||
<insecureRegistry>localhost:5000</insecureRegistry>
|
||||
</insecureRegistries>
|
||||
</from>
|
||||
<to>
|
||||
<image>light-delivery-app</image>
|
||||
@@ -208,6 +205,13 @@
|
||||
</outputPaths>
|
||||
<!-- 优化CI/CD构建 -->
|
||||
<containerizingMode>packaged</containerizingMode>
|
||||
<!-- 配置不安全的镜像仓库 -->
|
||||
<insecureRegistries>
|
||||
<insecureRegistry>localhost:5000</insecureRegistry>
|
||||
</insecureRegistries>
|
||||
<!-- 其他优化配置 -->
|
||||
<skip>false</skip>
|
||||
<useOnlyProjectProperties>true</useOnlyProjectProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
Reference in New Issue
Block a user