From 7063723ca2cb46ef2fe5141d2a8685d806de16d7 Mon Sep 17 00:00:00 2001 From: jiajiu123 <60831923+jiajiu123@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=BC=96=E8=AF=91=20Docker?= =?UTF-8?q?=20Image=20=E5=B9=B6=E6=8E=A8=E9=80=81=E8=87=B3=20Docker=20Hub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..aba87321 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,31 @@ +name: Docker Build and Push + +on: + push: + branches: + - main # 推送到main分支时触发 + tags: + - 'v*' # 推送v开头的tag时触发(例如v1.0.0) + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . # Docker构建上下文路径 + file: ./Dockerfile # Dockerfile路径 + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/maimbot:${{ github.ref_name }} + ${{ secrets.DOCKERHUB_USERNAME }}/maimbot:latest + push: true