mirror of
https://github.com/woodchen-ink/Oapi-Feishu.git
synced 2025-07-18 05:42:08 +08:00
优化 Docker 工作流,添加 Go 模块初始化及二进制构建步骤,调整 Dockerfile 中的文件路径
This commit is contained in:
parent
77f30efde8
commit
93e960ccd9
18
.github/workflows/docker.yml
vendored
18
.github/workflows/docker.yml
vendored
@ -27,6 +27,19 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Initialize Go module if needed
|
||||
working-directory: ./code
|
||||
run: |
|
||||
if [ ! -f go.mod ]; then
|
||||
go mod init github.com/${{ github.repository }}
|
||||
go mod tidy
|
||||
fi
|
||||
|
||||
- name: Build Go binary
|
||||
working-directory: ./code
|
||||
run: |
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} go build -ldflags '-w -s' -o ../feishu_chatgpt
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
@ -39,10 +52,6 @@ jobs:
|
||||
username: woodchen
|
||||
password: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
||||
- name: Build Go binary
|
||||
run: |
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }} go build -ldflags '-w -s' -o feishu_chatgpt
|
||||
|
||||
- name: Prepare Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
@ -62,4 +71,3 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
|
@ -4,6 +4,6 @@ WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
COPY feishu_chatgpt /app
|
||||
COPY role_list.yaml /app
|
||||
COPY code/role_list.yaml /app
|
||||
EXPOSE 9000
|
||||
ENTRYPOINT ["/app/feishu_chatgpt"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user