Skip to content

Instantly share code, notes, and snippets.

@erickthered
Last active May 29, 2023 16:27
Show Gist options
  • Save erickthered/c28a3259ed4450f7b71bd9caf647c0ce to your computer and use it in GitHub Desktop.
Save erickthered/c28a3259ed4450f7b71bd9caf647c0ce to your computer and use it in GitHub Desktop.
This is a bash script that will setup some development tools under a code-server docker environment. It will install: pyenv, openjdk 17, nvm, php, go, dotnet and ruby with rails on the base debian distribution.
# Set default theme and keyboard settings (you may not want this):
cat << EOF > ~/.local/share/code-server/User/settings.json
{
"workbench.colorTheme": "Default Dark Modern",
"keyboard.layout": "com.apple.keylayout.USInternational-PC"
}
EOF
sudo apt update
sudo apt install -y software-properties-common ca-certificates lsb-release apt-transport-https
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev openjdk-17-jdk postgresql-client mariadb-client
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
cat <<EOF | sudo tee /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/jdk-17/
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
cat <<EOF >> ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="\$PYENV_ROOT/bin:\$PATH"
eval "\$(pyenv init -)"
eval "\$(pyenv virtualenv-init -)"
EOF
cat <<EOF >> ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
EOF
# Install GO
curl -O https://dl.google.com/go/go1.20.4.linux-amd64.tar.gz
tar xzvf go1.20.4.linux-amd64.tar.gz
sudo mv go /usr/local
cat <<EOF >> ~/.bashrc
export GOPATH="$HOME/projects/go"
export PATH="\$PATH:/usr/local/go/bin:\$GOPATH/bin"
EOF
# Install dotnet
wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-7.0 aspnetcore-runtime-7.0
# Install Ruby and Rails
sudo apt install -y ruby-full
sudo gem install rails
# Install different PHP versions
wget https://packages.sury.org/php/apt.gpg
sudo apt-key add apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get update -y
sudo apt install -y php8.2-cli php7.4-cli php5.6-cli
# Install Code Server Extensions
code-server --install-extension bmewburn.vscode-intelephense-client
code-server --install-extension eamodio.gitlens
code-server --install-extension golang.go
code-server --install-extension ms-python.python
code-server --install-extension ms-toolsai.jupyter
code-server --install-extension ms-toolsai.jupyter-keymap
code-server --install-extension ms-toolsai.jupyter-renderers
code-server --install-extension ms-toolsai.vscode-jupyter-cell-tags
code-server --install-extension ms-toolsai.vscode-jupyter-slideshow
code-server --install-extension ms-vscode.sublime-keybindings
code-server --install-extension octref.vetur
code-server --install-extension rangav.vscode-thunder-client
code-server --install-extension redhat.java
rm apt.gpg go1.20.4.linux-amd64.tar.gz
docker run -it --rm --name code-server -p 8887:8080 \
-v "$HOME/.config:/home/coder/.config" \
-v "$PWD:/home/coder/projects" \
-u "$(id -u):$(id -g)" \
-e "DOCKER_USER=$USER" \
-e "GOPATH=/home/coder/projects/go" \
codercom/code-server:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment