mirror of
https://github.com/woodchen-ink/Oapi-Feishu.git
synced 2025-07-18 05:42:08 +08:00
优化 Docker 工作流以支持多平台构建与推送,并改进 Dockerfile 的跨平台处理
This commit is contained in:
parent
8e7b885957
commit
a4ba7c3486
14
.github/workflows/docker.yml
vendored
14
.github/workflows/docker.yml
vendored
@ -33,6 +33,20 @@ jobs:
|
|||||||
cd code
|
cd code
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags '-w -s' -o ../feishu_chatgpt-arm64
|
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
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
@ -7,12 +7,16 @@ RUN apk add --no-cache bash
|
|||||||
COPY feishu_chatgpt-* /app/
|
COPY feishu_chatgpt-* /app/
|
||||||
COPY code/role_list.yaml /app/
|
COPY code/role_list.yaml /app/
|
||||||
|
|
||||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
RUN ls -l /app && \
|
||||||
mv /app/feishu_chatgpt-amd64 /app/feishu_chatgpt; \
|
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||||
|
mv /app/feishu_chatgpt-amd64 /app/feishu_chatgpt || echo "amd64 binary not found"; \
|
||||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
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 && \
|
fi && \
|
||||||
chmod +x /app/feishu_chatgpt
|
ls -l /app && \
|
||||||
|
chmod +x /app/feishu_chatgpt || echo "Failed to set executable permission"
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
ENTRYPOINT ["/app/feishu_chatgpt"]
|
ENTRYPOINT ["/app/feishu_chatgpt"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user