Last active
August 16, 2023 15:43
-
-
Save alevz257/14acc8150caf943c3b1487a9ed69e377 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: 'gcr.io/cloud-builders/docker' | |
args: [ 'build', '-t', '<region>-docker.pkg.dev/<project id>/<artifact registry name>/custom-workstation:latest', '.' ] | |
- name: "gcr.io/cloud-builders/docker" | |
args: [ 'push', '<region>-docker.pkg.dev/<project id>/<artifact registry name>/custom-workstation:latest'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM us-central1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest | |
RUN wget -O- https://apt.releases.hashicorp.com/gpg | \ | |
gpg --dearmor | \ | |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg && \ | |
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ | |
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ | |
sudo tee /etc/apt/sources.list.d/hashicorp.list | |
RUN sudo apt update && sudo apt install -y zsh gnupg software-properties-common terraform | |
RUN apt-get clean | |
# Install zsh | |
ENV ZSH=/opt/workstation/oh-my-zsh | |
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \ | |
git clone https://github.com/zsh-users/zsh-autosuggestions /opt/workstation/oh-my-zsh/plugins/zsh-autosuggestions | |
# Install k9s | |
RUN curl -s https://api.github.com/repos/derailed/k9s/releases/latest \ | |
| grep "browser_download_url.*Linux_amd64.tar.gz" \ | |
| cut -d : -f 2,3 \ | |
| tr -d \" \ | |
| wget -qi - && mkdir -p /opt/workstation/bin && tar -xf k9s_Linux_amd64.tar.gz -C /opt/workstation/bin | |
# Install extensions | |
RUN wget -O terraform.vsix $(curl -q https://open-vsx.org/api/hashicorp/terraform/linux-x64 | jq -r '.files.download') \ | |
&& unzip terraform.vsix "extension/*" \ | |
&& mv extension /opt/code-oss/extensions/terraform | |
RUN wget -O vscode-icons.vsix $(curl -q https://open-vsx.org/api/vscode-icons-team/vscode-icons | jq -r '.files.download') \ | |
&& unzip vscode-icons.vsix "extension/*" \ | |
&& mv extension /opt/code-oss/extensions/vscode-icons | |
# Copy workstation customization script | |
COPY workstation-customization.sh /etc/workstation-startup.d/211_workstation-customization.sh | |
RUN chmod +x /etc/workstation-startup.d/211_workstation-customization.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CODEOSS_PATH="/home/user/.codeoss-cloudworkstations" | |
SETTINGS_PATH="$CODEOSS_PATH/data/Machine" | |
mkdir -p $SETTINGS_PATH | |
cat << EOF > $SETTINGS_PATH/settings.json | |
{ | |
"workbench.colorTheme": "Default Dark+", | |
"terminal.integrated.defaultProfile.linux": "zsh", | |
"cloudcode.project": <project id>, | |
} | |
EOF | |
chown -R user:user $CODEOSS_PATH | |
chmod -R 755 $CODEOSS_PATH | |
export ZSH=/opt/workstation/oh-my-zsh | |
if [ -f "/home/user/.zshrc" ]; then | |
echo "ZSH already configured" | |
else | |
cat << 'EOF' > /home/user/.zshrc | |
export PATH="$PATH:/opt/workstation/bin" | |
export ZSH_THEME="robbyrussell" | |
export ZSH=/opt/workstation/oh-my-zsh | |
plugins=( | |
git | |
zsh-autosuggestions | |
kubectl | |
) | |
alias tf='terraform' | |
alias kc='kubectl' | |
alias code='code-oss-cloud-workstations' | |
source "$ZSH/oh-my-zsh.sh" | |
EOF | |
chsh -s $(which zsh) user | |
fi | |
zsh -c "source $ZSH/oh-my-zsh.sh" | |
chown -R user:user /home/user | |
chown -R user:user /opt/workstation | |
chmod -R 755 /opt/workstation"#!/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment