Files
bl/.ide/Dockerfile

78 lines
2.8 KiB
Go
Raw Normal View History

2026-03-28 13:22:58 +08:00
# 此文件为远程开发环境配置文件
2026-01-29 12:20:47 +08:00
FROM debian:bookworm
2026-01-29 12:33:40 +08:00
ENV GO_VERSION=1.25.0
2026-03-28 14:42:01 +08:00
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
2026-01-29 12:20:47 +08:00
2026-03-28 14:42:01 +08:00
# 安装系统依赖
RUN apt update && \
apt install -y wget rsync unzip openssh-server vim lsof git git-lfs \
2026-03-28 15:03:39 +08:00
locales libgit2-1.5 libgit2-dev net-tools jq curl ca-certificates sudo && \
rm -rf /var/lib/apt/lists/*
2026-03-28 09:48:56 +08:00
2026-03-28 15:03:39 +08:00
# 安装 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
2026-03-28 09:48:56 +08:00
2026-03-28 15:03:39 +08:00
# 安装 code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
2026-03-28 13:39:42 +08:00
2026-03-28 15:16:02 +08:00
# 安装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
2026-03-28 17:51:31 +08:00
# 修复直接执行你提供的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
2026-03-28 15:46:42 +08:00
2026-03-28 17:45:47 +08:00
2026-03-28 17:51:31 +08:00
2026-03-28 18:09:53 +08:00
# 安装 code-server 插件逐个安装失败不阻断便于定位问题
# 已移除 pinage404.git-extension-pack该扩展包会额外拉取多个依赖扩展
# code-server/Open VSX 环境中容易出现部分依赖不可用导致插件不可用体验
RUN set -eux; \
USER_DATA_DIR=/root/.local/share/code-server; \
mkdir -p "${USER_DATA_DIR}/extensions"; \
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 \
ms-azuretools.vscode-docker \
; do \
if ! /usr/bin/code-server --install-extension "${ext}" --user-data-dir "${USER_DATA_DIR}"; then \
FAILED_EXTENSIONS="${FAILED_EXTENSIONS} ${ext}"; \
echo "WARN: extension install failed: ${ext}"; \
fi; \
done; \
chown -R root:root "${USER_DATA_DIR}"; \
if [ -n "${FAILED_EXTENSIONS}" ]; then \
echo "以下插件安装失败:${FAILED_EXTENSIONS}"; \
else \
echo "所有插件安装完成 ✅"; \
fi
2026-03-28 17:45:47 +08:00
2026-03-28 15:46:42 +08:00
# 最后再清理必须放在插件安装之后
RUN apt clean && rm -rf /var/lib/apt/lists/*
2026-03-28 17:51:31 +08:00
2026-03-28 18:09:53 +08:00