From 24cf1f788bdbb017fd18ec34de371b0964c17a3a Mon Sep 17 00:00:00 2001 From: MR-ZC <1475796375@qq.com> Date: Tue, 25 Mar 2025 19:03:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20GitHub=20Actions=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E4=BB=A5=E6=94=AF=E6=8C=81=20Docker?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E7=9A=84=E6=89=93=E5=8C=85=E5=92=8C?= =?UTF-8?q?=E5=8F=91=E5=B8=83=EF=BC=8C=E5=B9=B6=E9=83=A8=E7=BD=B2=E5=88=B0?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=81=E7=A8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-compose-build.yml | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/docker-compose-build.yml diff --git a/.github/workflows/docker-compose-build.yml b/.github/workflows/docker-compose-build.yml new file mode 100644 index 0000000..579a1b7 --- /dev/null +++ b/.github/workflows/docker-compose-build.yml @@ -0,0 +1,35 @@ +name: 打包发布docker镜像 +on: + push: + branches: [ docker-compose ] + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - name: 拉取代码🔄 + uses: actions/checkout@v4 + + - name: Set up Docker Buildx🔧 + uses: docker/setup-buildx-action@v3 + + - name: 打包并发布镜像📦 + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + tags: registry.fandouke.com/test-image:latest + push: true + + - name: 部署到远程服务器🚀 + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.REMOTE_HOST }} + username: ${{ secrets.REMOTE_USER }} + password: ${{ secrets.REMOTE_PASSWORD }} + script: | + docker pull registry.fandouke.com/test-image:latest + docker-compose down || true + docker-compose up -d + +