From 933df5765411f7c16e71c64f1243776016c0b823 Mon Sep 17 00:00:00 2001 From: itgpt <136777961+itgpt-com@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:53:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=20docker=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 45 +++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 1828268bf..e374cfde8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -4,20 +4,39 @@ on: release: types: [published] workflow_dispatch: + jobs: - publish-latest-docker-image: + publish-docker: runs-on: ubuntu-latest - name: Build and publish docker image steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Build image - run: | - git clone https://github.com/Soulter/AstrBot - cd AstrBot - docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/astrbot:latest . - - name: Publish image - run: | - docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} - docker push ${{ secrets.DOCKER_HUB_USERNAME }}/astrbot:latest + - name: 拉取源码 + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: 设置 QEMU + uses: docker/setup-qemu-action@v3 + + - name: 设置 Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: 登录到 DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: 构建和推送 Docker hub + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKER_HUB_USERNAME }}/astrbot:latest + ${{ secrets.DOCKER_HUB_USERNAME }}/astrbot:${{ github.event.release.tag_name }} + + - name: Post build notifications + run: echo "Docker image has been built and pushed successfully" + From 1d6ea2dbe6078d8a37c19e44dc0dbd607945d527 Mon Sep 17 00:00:00 2001 From: itgpt <136777961+itgpt-com@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:16:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 93c0a2914..9e027f258 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,4 +5,7 @@ COPY . /AstrBot/ RUN python -m pip install -r requirements.txt +EXPOSE 6185 +EXPOSE 6186 + CMD [ "python", "main.py" ] From 0c679a0151f6a6d20cfeb1638289cefb4d063d51 Mon Sep 17 00:00:00 2001 From: itgpt <136777961+itgpt-com@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:21:30 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20.dockerignore=20?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=20docker=20cp=20=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=82=E7=BC=A9=E5=B0=8F=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ddad8690a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +# github acions +.github/ +.*ignore +# User-specific stuff +.idea/ +# Byte-compiled / optimized / DLL files +__pycache__/ +# Environments +.env +.venv +env/ +venv*/ +ENV/ +.conda/ +README*.md From 73dd4703b9fcaf7f41cd7ee355bee63428940a14 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Thu, 8 Aug 2024 22:15:05 +0800 Subject: [PATCH 4/4] Update .dockerignore --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index ddad8690a..f27cf068c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ # github acions .github/ .*ignore +.git/ # User-specific stuff .idea/ # Byte-compiled / optimized / DLL files