diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml index c5032b7b..76f73055 100644 --- a/.github/workflows/push_image.yml +++ b/.github/workflows/push_image.yml @@ -24,7 +24,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - woodchen/certimate + woodchen/certimate:latest - name: Log in to DOCKERHUB uses: docker/login-action@v3 @@ -37,6 +37,22 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} + + - name: 部署到服务器 + uses: appleboy/ssh-action@master + env: + DOCKER_IMAGE: woodchen/certimate:latest + PROJECT_PATH: ${{ secrets.PROJECT_PATH }} + with: + host: ${{ secrets.SERVER_IP }} + username: root + key: ${{ secrets.SERVER_SSH_KEY }} + envs: DOCKER_IMAGE,PROJECT_PATH + script: | + docker pull $DOCKER_IMAGE + cd $PROJECT_PATH + docker compose down + docker compose up -d