diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index d324ed0..9b7bd86 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -28,7 +28,13 @@ jobs: echo "Runner 工作目录: $(pwd)" echo "Docker 信息:" docker --version - docker info + 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: 等待应用启动并健康检查 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 055a19c..0ee0057 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/pom.xml b/pom.xml index 44f5581..499cb17 100644 --- a/pom.xml +++ b/pom.xml @@ -171,9 +171,6 @@ openjdk:17-jdk-slim - - localhost:5000 - light-delivery-app @@ -208,6 +205,13 @@ packaged + + + localhost:5000 + + + false + true