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