From a4ba7c34865bdad82e95763964122d2ab743a4c1 Mon Sep 17 00:00:00 2001 From: wood chen Date: Wed, 9 Oct 2024 13:14:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Docker=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E4=BB=A5=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=9E=84=E5=BB=BA=E4=B8=8E=E6=8E=A8=E9=80=81=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E6=94=B9=E8=BF=9B=20Dockerfile=20=E7=9A=84=E8=B7=A8?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 14 ++++++++++++++ Dockerfile.multi | 12 ++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f36160c..7a774fe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,6 +33,20 @@ jobs: cd code CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags '-w -s' -o ../feishu_chatgpt-arm64 + - name: List files + run: ls -l + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.multi + platforms: linux/amd64,linux/arm64 + push: true + tags: | + woodchen/${{ env.IMAGE_NAME }}:latest + woodchen/${{ env.IMAGE_NAME }}:${{ github.sha }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/Dockerfile.multi b/Dockerfile.multi index 1198f10..81ed69b 100644 --- a/Dockerfile.multi +++ b/Dockerfile.multi @@ -7,12 +7,16 @@ RUN apk add --no-cache bash COPY feishu_chatgpt-* /app/ COPY code/role_list.yaml /app/ -RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - mv /app/feishu_chatgpt-amd64 /app/feishu_chatgpt; \ +RUN ls -l /app && \ + if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + mv /app/feishu_chatgpt-amd64 /app/feishu_chatgpt || echo "amd64 binary not found"; \ elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ - mv /app/feishu_chatgpt-arm64 /app/feishu_chatgpt; \ + mv /app/feishu_chatgpt-arm64 /app/feishu_chatgpt || echo "arm64 binary not found"; \ + else \ + echo "Unknown platform: $TARGETPLATFORM"; \ fi && \ - chmod +x /app/feishu_chatgpt + ls -l /app && \ + chmod +x /app/feishu_chatgpt || echo "Failed to set executable permission" EXPOSE 9000 ENTRYPOINT ["/app/feishu_chatgpt"]