编辑文件 Dockerfile

This commit is contained in:
xinian
2026-01-29 12:20:47 +08:00
committed by cnb
parent 20a47a63ba
commit e3cdf2dbaa

View File

@@ -1,23 +1,45 @@
# .ide/Dockerfile # 此文件为远程开发环境配置文件
FROM debian:bookworm
# 可将 node 替换为需要的基础镜像 ENV GO_VERSION=1.24.1
FROM go:1.25
# 安装 code-server vscode 常用插件 RUN apt update &&\
RUN curl -fsSL https://code-server.dev/install.sh | sh \ apt install -y wget rsync unzip openssh-server vim lsof git git-lfs locales locales-all libgit2-1.5 libgit2-dev net-tools jq curl &&\
&& code-server --install-extension cnbcool.cnb-welcome \ rm -rf /var/lib/apt/lists/*
&& code-server --install-extension redhat.vscode-yaml \
&& code-server --install-extension dbaeumer.vscode-eslint \
&& code-server --install-extension waderyan.gitblame \
&& code-server --install-extension mhutchie.git-graph \
&& code-server --install-extension donjayamanne.githistory \
&& code-server --install-extension tencent-cloud.coding-copilot \
&& code-server --install-extension golang.go \
&& echo done
# 安装 ssh 服务用于支持 VSCode 等客户端通过 Remote-SSH 访问开发环境也可按需安装其他软件 # install golang
RUN apt-get update && apt-get install -y git wget unzip openssh-server 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 &&\
ln -sf /usr/local/go/bin/go /usr/bin/go &&\
ln -sf /usr/local/go/bin/gofmt /usr/bin/gofmt &&\
curl -sSfL https://raw.bgithub.xyz/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 &&\
rm -rf go${GO_VERSION}.linux-amd64.tar.gz
# 指定字符集支持命令行输入中文根据需要选择字符集 # install code-server
ENV LANG C.UTF-8 RUN curl -fsSL https://code-server.dev/install.sh | sh
ENV LANGUAGE C.UTF-8 RUN code-server --install-extension dbaeumer.vscode-eslint &&\
code-server --install-extension pinage404.git-extension-pack &&\
code-server --install-extension redhat.vscode-yaml &&\
code-server --install-extension esbenp.prettier-vscode &&\
code-server --install-extension golang.go &&\
code-server --install-extension eamodio.gitlens &&\
code-server --install-extension waderyan.gitblame &&\
code-server --install-extension donjayamanne.githistory &&\
code-server --install-extension mhutchie.git-graph &&\
code-server --install-extension ms-azuretools.vscode-docker &&\
code-server --install-extension PKief.material-icon-theme &&\
code-server --install-extension tencent-cloud.coding-copilot &&\
echo done
# install Go Tools
ENV GOPATH /root/go
ENV PATH="${PATH}:${GOPATH}/bin"
RUN go install -v golang.org/x/tools/gopls@latest
# install goreleaser
RUN go install github.com/goreleaser/goreleaser/v2@latest
ENV LC_ALL zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8