diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bb1dacb..b7c3a0d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 }} - diff --git a/Dockerfile b/Dockerfile index 944912d..98db6d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]