编辑文件 Dockerfile
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-28 10:51:42 +08:00
committed by cnb
parent 334001f844
commit 6e0fc50b9f

View File

@@ -15,7 +15,7 @@ RUN curl -fsSLO https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz &&\
curl -sSfL https://raw.github.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 &&\
rm -rf go${GO_VERSION}.linux-amd64.tar.gz
# install code-server + 插件
# install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
RUN code-server --install-extension dbaeumer.vscode-eslint &&\
code-server --install-extension pinage404.git-extension-pack &&\
@@ -32,10 +32,15 @@ RUN code-server --install-extension dbaeumer.vscode-eslint &&\
echo done
# ==============================================
# 🔥 关键修复:自动修复 openai.chatgpt 插件 navigator 报错
# 🔥 关键修复解决 openai.chatgpt 插件 navigator 报错
# ==============================================
RUN sed -i '1i if (typeof navigator === '"'"'undefined'"'"') global.navigator = { userAgent: '"'"'code-server'"'"' };' \
/root/.local/share/code-server/extensions/openai.chatgpt-*/out/extension.js
RUN for ext_dir in /root/.local/share/code-server/extensions/openai.chatgpt*; do \
if [ -d "$ext_dir" ]; then \
sed -i 's/"extensionKind":\s*\["ui"\]/"extensionKind": ["ui", "workspace"]/g' "$ext_dir/package.json" 2>/dev/null || true; \
sed -i '1i if (typeof navigator === '"'"'undefined'"'"') global.navigator = { userAgent: '"'"'code-server'"'"' };' "$ext_dir/out/extension.js" 2>/dev/null || true; \
echo "Patched $(basename $ext_dir) for code-server compatibility"; \
fi; \
done
# install Go Tools
ENV GOPATH /root/go
@@ -46,11 +51,10 @@ RUN go install -v github.com/cweill/gotests/gotests@latest
RUN go install -v github.com/josharian/impl@latest
RUN go install -v github.com/haya14busa/goplay/cmd/goplay@latest
RUN go install -v github.com/go-delve/delve/cmd/dlv@latest
# install goreleaser
RUN go install github.com/goreleaser/goreleaser/v2@latest
# 配置 codex
RUN curl -fsSL https://oss.itbzzb.cn/setup-codex.sh | YES=1 bash -s -- --base-url https://api.jucode.cn/v1 --api-key 46e4e09f98b442a98e8e63d3ce94e3ff --mirror auto
ENV LC_ALL zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8