vs / Dockerfile
ufe's picture
Update Dockerfile
20ba83a verified
raw
history blame contribute delete
No virus
5.53 kB
FROM ubuntu:latest
# 更新软件包列表并安装基本工具
RUN apt-get update && apt-get install -y \
build-essential \
net-tools \
fonts-noto-cjk \
chromium-browser \
chromium-browser \
curl \
git \
wget \
unzip \
software-properties-common
# 安装 zsh、ripgrep
RUN apt-get install -y zsh ripgrep golang screen vim cmake openjdk-17-jdk openjdk-17-jre gdb
# 安装 Python 和 pip,以及 conda
RUN apt-get install -y python3 python3-pip
# 安装 C 和 C++ 编译器
RUN apt-get install -y gcc g++
# 安装 Ruby
RUN apt-get install -y nodejs
RUN apt-get clean
# 安装 Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# 下载并安装 Visual Studio Code 服务版
RUN wget -O vscode.tar.gz "https://update.code.visualstudio.com/latest/server-linux-x64-web/stable" && \
mkdir -p /usr/local/vscode && \
tar -xzf vscode.tar.gz -C /usr/local/vscode --strip-components=1 && \
rm vscode.tar.gz
# Switch to the "user" user
USER ubuntu
# 安装 zsh、ripgrep 和 oh-my-zsh
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
sed -i 's/robbyrussell/bira/g' /home/ubuntu/.zshrc && \
echo 'plugins=(git golang node npm pip python debian extract)' >> /home/ubuntu/.zshrc
# 安装 flutter
RUN git clone https://github.com/flutter/flutter.git -b stable --depth 1 /home/ubuntu/.local/flutter && \
/home/ubuntu/.local/flutter/bin/flutter config --no-analytics && \
/home/ubuntu/.local/flutter/bin/flutter precache && \
echo 'export PATH=$PATH:/home/ubuntu/.local/flutter/bin:/home/ubuntu/.local/conda/bin' >> /home/ubuntu/.bashrc && \
echo 'export PATH=$PATH:/home/ubuntu/.local/flutter/bin:/home/ubuntu/.local/conda/bin' >> /home/ubuntu/.zshrc
# Set home to the user's home directory
ENV HOME=/home/ubuntu \
PATH=/home/ubuntu/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# 安装 Node.js 和 npm,以及 nvm 和 pnpm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash && \
echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> /home/ubuntu/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/ubuntu/.zshrc && \
. ~/.nvm/nvm.sh
# 安装 Visual Studio Code 插件
RUN mkdir -p /home/ubuntu/.vscode && \
/usr/local/vscode/bin/code-server --extensions-dir /home/ubuntu/.vscode \
--install-extension aaron-bond.better-comments \
--install-extension adpyke.codesnap \
--install-extension ccagml.vscode-leetcode-problem-rating \
--install-extension dart-code.dart-code \
--install-extension dart-code.flutter \
--install-extension dbaeumer.vscode-eslint \
--install-extension dsznajder.es7-react-js-snippets \
--install-extension eamodio.gitlens \
--install-extension editorconfig.editorconfig \
--install-extension esbenp.prettier-vscode \
--install-extension formulahendry.code-runner \
--install-extension giscafer.leek-fund \
--install-extension golang.go \
--install-extension humao.rest-client \
--install-extension johnpapa.vscode-peacock \
--install-extension leetcode.vscode-leetcode \
--install-extension ms-azuretools.vscode-docker \
--install-extension ms-python.debugpy \
--install-extension ms-python.isort \
--install-extension ms-python.python \
--install-extension ms-python.vscode-pylance \
--install-extension ms-toolsai.jupyter \
--install-extension ms-toolsai.jupyter-keymap \
--install-extension ms-toolsai.jupyter-renderers \
--install-extension ms-toolsai.vscode-jupyter-cell-tags \
--install-extension ms-toolsai.vscode-jupyter-slideshow \
--install-extension ms-vscode-remote.remote-containers \
--install-extension ms-vscode-remote.remote-ssh \
--install-extension ms-vscode-remote.remote-ssh-edit \
--install-extension ms-vscode.cpptools \
--install-extension ms-vscode.cpptools-extension-pack \
--install-extension ms-vscode.cpptools-themes \
--install-extension ms-vscode.js-debug-companion \
--install-extension ms-vscode.remote-explorer \
--install-extension msjsdiag.vscode-react-native \
--install-extension rangav.vscode-thunder-client \
--install-extension redhat.java \
--install-extension rust-lang.rust-analyzer \
--install-extension shd101wyy.markdown-preview-enhanced \
--install-extension streetsidesoftware.code-spell-checker \
--install-extension twxs.cmake \
--install-extension visualstudioexptteam.vscodeintellicode \
--install-extension vscjava.vscode-java-debug \
--install-extension vscjava.vscode-java-dependency \
--install-extension vscjava.vscode-java-pack \
--install-extension vscjava.vscode-java-test \
--install-extension vscjava.vscode-maven \
--install-extension vscodevim.vim \
--install-extension wayou.vscode-todo-highlight \
--install-extension webfreak.debug \
--install-extension wix.vscode-import-cost \
--install-extension wmaurer.change-case \
--install-extension zhuangtongfa.material-theme
# 暴露 Visual Studio Code 服务版的默认端口
EXPOSE 7860
# 启动 Visual Studio Code 服务版
ENTRYPOINT ["/bin/sh", "-c", "exec /usr/local/vscode/bin/code-server --extensions-dir /home/ubuntu/.vscode --port=7860 --connection-token=${PASSWORD} --host=0.0.0.0 --accept-server-license-terms", "--"]