Closed omegazeng closed 1 year ago
dockerhub的镜像是考虑了不同架构的
解决办法参考 #39 (comment)
这个配置是没有问题的,但是Dockerfile中GOARCH=amd64,只会编译出amd64的二进制文件,所以建议去掉这个参数,让编译器自行根据编译的平台架构选择。
我本地测试过了,可以正常运行。
ubuntu@ubuntu:~/feishu-chatgpt$ git diff
diff --git a/Dockerfile b/Dockerfile
index 779a67a..36a9da9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,7 +7,7 @@ ENV GO111MODULE=on \
WORKDIR /build
ADD /code /build
-RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-w -s' -o feishu_chatgpt
+RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-w -s' -o feishu_chatgpt^M
FROM alpine:latest
ubuntu@ubuntu:~/feishu-chatgpt$ nerdctl build -t feishu-chatgpt:latest .
[+] Building 261.2s (19/19)
[+] Building 261.3s (19/19)
[+] Building 261.8s (19/19) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 554B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 2.2s
=> [internal] load metadata for docker.io/library/golang:latest 4.0s
=> [auth] library/alpine:pull token for registry-1.docker.io 0.0s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> [golang 1/4] FROM docker.io/library/golang@sha256:41a6cb5f24c205e78cf153ed1d5328f2279e750d3cde797f545d06921fa90101 120.4s
=> => resolve docker.io/library/golang@sha256:41a6cb5f24c205e78cf153ed1d5328f2279e750d3cde797f545d06921fa90101 0.1s
=> => sha256:e4448c0417600559e42495fd89e50861c077abadd76352ec7d80182dab6e8a35 95.44MB / 95.44MB 19.0s
=> => sha256:23b719e10464e4c2474146ae92e950047f69922ab408472e8ab552bf18433378 157B / 157B 0.5s
=> => sha256:c71e83b44ada3262ebe71aced3f6deb0841fb8445b71655a63800119ca885f0c 81.40MB / 81.40MB 26.6s
=> => sha256:1714880ecc1c021a5f708f4369f91d3c2c53b998a56d563d0a9aa9be2488d794 54.68MB / 54.68MB 11.8s
=> => sha256:26c861b53509d61c37240d2f80efb3a351d2f1d7f4f8e8ec2e5004c1d86af89c 10.87MB / 10.87MB 6.3s
=> => sha256:7971239fe1d69763272ccc0b2527efa95547d37c53630ed0a71db4e00d3ef964 5.15MB / 5.15MB 12.4s
=> => sha256:8022b074731d9ecee7f4fba79b993920973811dda168bbc08636f18523b90122 53.70MB / 53.70MB 19.2s
=> => extracting sha256:8022b074731d9ecee7f4fba79b993920973811dda168bbc08636f18523b90122 7.9s
=> => extracting sha256:7971239fe1d69763272ccc0b2527efa95547d37c53630ed0a71db4e00d3ef964 1.0s
=> => extracting sha256:26c861b53509d61c37240d2f80efb3a351d2f1d7f4f8e8ec2e5004c1d86af89c 1.1s
=> => extracting sha256:1714880ecc1c021a5f708f4369f91d3c2c53b998a56d563d0a9aa9be2488d794 11.1s
=> => extracting sha256:c71e83b44ada3262ebe71aced3f6deb0841fb8445b71655a63800119ca885f0c 10.4s
=> => extracting sha256:e4448c0417600559e42495fd89e50861c077abadd76352ec7d80182dab6e8a35 57.0s
=> => extracting sha256:23b719e10464e4c2474146ae92e950047f69922ab408472e8ab552bf18433378 0.1s
=> [stage-1 1/7] FROM docker.io/library/alpine:latest@sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517 0.1s
=> => resolve docker.io/library/alpine:latest@sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517 0.1s
=> [internal] load build context 0.1s
=> => transferring context: 1.66kB 0.0s
=> [golang 2/4] WORKDIR /build 20.7s
=> [golang 3/4] ADD /code /build 0.2s
=> [golang 4/4] RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-w -s' -o feishu_chatgpt 112.2s
=> CACHED [stage-1 2/7] WORKDIR /dist 0.0s
=> CACHED [stage-1 3/7] RUN apk add --no-cache bash 0.0s
=> CACHED [stage-1 4/7] COPY --from=golang /build/config.example.yaml /dist/config.yaml 0.0s
=> CACHED [stage-1 5/7] COPY --from=golang /build/feishu_chatgpt /dist 0.0s
=> CACHED [stage-1 6/7] ADD entrypoint.sh /dist/entrypoint.sh 0.0s
=> CACHED [stage-1 7/7] RUN chmod +x /dist/entrypoint.sh 0.0s
=> exporting to docker image format 2.6s
=> => exporting layers 0.0s
=> => exporting manifest sha256:393352831d5ec81af43fc9ef92c2574c46944c5ad8909c0254e30ff575b17246 0.1s
=> => exporting config sha256:4d1f82b95248395ff93c707e77d6216177ecd7c297455fe2f8a68ff3488f8844 0.0s
=> => sending tarball 2.5s
ubuntu@ubuntu:~/feishu-chatgpt$ nerdctl run --rm -it feishu-chatgpt:latest
[Warning] You need to set APP_ID before running!
[Warning] You need to set APP_SECRET before running!
[Warning] You need to set APP_ENCRYPT_KEY before running!
[Warning] You need to set APP_VERIFICATION_TOKEN before running!
[Warning] You need to set BOT_NAME before running!
[Warning] You need to set OPENAI_KEY before running!
[Success] Configuration file has been generated!
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /ping --> main.main.func2 (3 handlers)
[GIN-debug] POST /webhook/event --> github.com/larksuite/oapi-sdk-gin.NewEventHandlerFunc.func1 (3 handlers)
[GIN-debug] POST /webhook/card --> github.com/larksuite/oapi-sdk-gin.NewCardActionHandlerFunc.func1 (3 handlers)
2023/03/24 03:53:16 http server started: http://localhost:9000/webhook/event
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :9000
^Cubuntu@ubuntu:~/feishu-chatgpt$
ubuntu@ubuntu:~/feishu-chatgpt$ uname -a
Linux ubuntu 5.15.0-1025-raspi #27-Ubuntu SMP PREEMPT Thu Feb 16 17:09:55 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
Thx.
错误报告 🐞
不支持arm64
错误描述 🤔
我在 hub.docker.com 找到你的镜像,
显示支持arm64,实际上不支持
Dockerfile中已经hardcode amd64架构 https://github.com/Leizhenpeng/feishu-chatgpt/blob/master/Dockerfile#L10
附加信息 📝
请提供以下信息以帮助我们更快地解决问题:
感谢您的反馈!🙏