From 976ac2017e1ce407377e07ae29ae00228c1543f0 Mon Sep 17 00:00:00 2001 From: MR-ZC <1475796375@qq.com> Date: Tue, 25 Mar 2025 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20GitHub=20Actions=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=88=B0=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E6=AD=A5=E9=AA=A4=EF=BC=8C=E4=BB=A5=E4=BE=BF=E4=BA=8E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E9=95=9C=E5=83=8F=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E5=92=8C=E5=AE=B9=E5=99=A8=E7=AE=A1=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 1776b23..6655ea9 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -13,11 +13,26 @@ jobs: - name: Set up Docker Buildx🔧 uses: docker/setup-buildx-action@v3 - - name: 打包并发布镜像📦 uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile # 指定 Dockerfile 路径 tags: registry.fandouke.com/test-image:latest # 镜像标签(包含 Registry 地址) - push: true \ No newline at end of file + 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 stop test-container || true + docker rm test-container || true + docker run -d --name test-container \ + -p 5000:5000 \ + registry.fandouke.com/test-image:latest + +