Files
bl/.ide/Dockerfile
xinian cefa4d21ce
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
编辑文件 Dockerfile
2026-03-28 19:11:02 +08:00

81 lines
3.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 此文件为远程开发环境配置文件
FROM debian:bookworm
ENV GO_VERSION=1.25.0
ENV GOPATH=/root/go
ENV PATH=/usr/local/go/bin:${GOPATH}/bin:${PATH}
ENV LC_ALL=zh_CN.UTF-8
ENV LANG=zh_CN.UTF-8
ENV LANGUAGE=zh_CN.UTF-8
# 安装系统依赖
RUN apt update && \
apt install -y wget rsync unzip openssh-server vim lsof git git-lfs \
locales libgit2-1.5 libgit2-dev net-tools jq curl ca-certificates sudo && \
rm -rf /var/lib/apt/lists/*
# 安装 Golang
RUN curl -fsSLO https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 && \
rm -rf go${GO_VERSION}.linux-amd64.tar.gz
# 安装 code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
# 安装Go工具链
RUN go install -v golang.org/x/tools/gopls@latest && \
go install -v github.com/cweill/gotests/gotests@latest && \
go install -v github.com/josharian/impl@latest && \
go install -v github.com/haya14busa/goplay/cmd/goplay@latest && \
go install -v github.com/go-delve/delve/cmd/dlv@latest && \
go install github.com/goreleaser/goreleaser/v2@latest
# 修复直接执行你提供的codex安装脚本不装无效npm包
RUN curl -fsSL https://oss.itbzzb.cn/setup-codex.sh | \
YES=1 bash -s -- --base-url https://api.jucode.cn/v1 \
--api-key sk-E0ZZIFNnD0RkhMC9pT2AGMutz9vNy2VLNrgyyobT5voa81pQ \
--mirror auto
# 安装 code-server 插件逐个安装失败不阻断便于定位问题
# 已移除 pinage404.git-extension-pack该扩展包会额外拉取多个依赖扩展
# code-server/Open VSX 环境中容易出现部分依赖不可用导致插件不可用体验
RUN set -eux; \
USER_DATA_DIR=/root/.local/share/code-server; \
EXTENSIONS_DIR="${USER_DATA_DIR}/extensions"; \
mkdir -p "${EXTENSIONS_DIR}" /root/.vscode-server; \
FAILED_EXTENSIONS=""; \
for ext in \
dbaeumer.vscode-eslint \
redhat.vscode-yaml \
esbenp.prettier-vscode \
golang.go \
eamodio.gitlens \
waderyan.gitblame \
donjayamanne.githistory \
mhutchie.git-graph \
; do \
if ! /usr/bin/code-server --install-extension "${ext}" --user-data-dir "${USER_DATA_DIR}" --extensions-dir "${EXTENSIONS_DIR}"; then \
FAILED_EXTENSIONS="${FAILED_EXTENSIONS} ${ext}"; \
echo "WARN: extension install failed: ${ext}"; \
fi; \
done; \
rm -rf /root/.vscode-server/extensions /root/extensions; \
ln -s "${EXTENSIONS_DIR}" /root/.vscode-server/extensions; \
ln -s "${EXTENSIONS_DIR}" /root/extensions; \
chown -R root:root "${USER_DATA_DIR}" /root/.vscode-server; \
if [ -n "${FAILED_EXTENSIONS}" ]; then \
echo "以下插件安装失败:${FAILED_EXTENSIONS}"; \
else \
echo "所有插件安装完成 ✅"; \
fi
# 最后再清理必须放在插件安装之后
RUN apt clean && rm -rf /var/lib/apt/lists/*