add gitpod.yml

This commit is contained in:
Abel Luck 2023-06-02 09:11:49 +00:00
parent bf8d2d621e
commit 1610ec0e57
2 changed files with 119 additions and 0 deletions

78
.gitpod.dockerfile Normal file
View file

@ -0,0 +1,78 @@
FROM gitpod/workspace-full
# install tools we need
RUN set -ex; \
pyenv global system; \
sudo add-apt-repository ppa:ansible/ansible; \
sudo add-apt-repository ppa:maxmind/ppa; \
curl -s https://helm.baltorepo.com/organization/signing.asc | sudo apt-key add - ; \
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash; \
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list ; \
sudo apt-get update; \
sudo apt-get -y upgrade ; \
sudo apt-get install -y \
ansible \
build-essential \
httpie \
fd-find \
ffmpeg \
geoipupdate \
gitlab-runner \
helm \
htop \
iotop \
iptraf \
jq \
kitty-terminfo \
libolm-dev \
ncdu \
postgresql \
pwgen \
python3-wheel \
ripgrep \
rsync \
scdaemon \
socat \
tmux \
unrar \
unzip \
vifm \
vim \
yamllint \
zsh \
zsh-syntax-highlighting \
; sudo rm -rf /var/lib/apt/lists/*
RUN set -ex; \
brew install \
zoxide \
fzf;
# needed for tailscale
RUN sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-nft
# install npm global packages we need
RUN set -ex; \
npm install -g \
standard-version \
turbo \
;
# make a place for all our warez
RUN sudo mkdir -p /usr/local/bin
# install AWS' kubectl
# from https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
ARG KUBECTL_URL="https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl"
RUN set -ex; \
curl -o kubectl "${KUBECTL_URL}"; \
chmod +x kubectl; \
sudo mv kubectl /usr/local/bin
# install cloudflared
# from https://github.com/cloudflare/cloudflared/releases
ARG CLOUDFLARED_VERSION="2023.2.1"
RUN set -ex; \
wget --progress=dot:mega https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-amd64.deb; \
sudo dpkg -i cloudflared-linux-amd64.deb; \
cloudflared --version

41
.gitpod.yml Normal file
View file

@ -0,0 +1,41 @@
---
# build the docker image for our gitpod from this dockerfile
image:
file: .gitpod.dockerfile
# where gitpod should place our workspace (relative to /workspace)
workspaceLocation: "."
# all init+before are run in prebuilds, and on workspace startup
tasks:
- name: tailscaled
command: |
if [ -n "$TAILSCALE_AUTHKEY" ]; then
if [ -n "${TAILSCALE_STATE_MYPROJECT}" ]; then
# restore the tailscale state from gitpod user's env vars
sudo mkdir -p /var/lib/tailscale
echo "${TAILSCALE_STATE_MYPROJECT}" | sudo tee /var/lib/tailscale/tailscaled.state > /dev/null
fi
sudo tailscaled
fi
- name: tailscale
command: |
cd /workspace/guardianproject-ops/meta/
if [ -n "$TAILSCALE_AUTHKEY" ]; then
if [ -n "${TAILSCALE_STATE_MYPROJECT}" ]; then
sudo -E tailscale up --authkey=${TAILSCALE_AUTHKEY}
else
sudo -E tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname "gitpod-${GITPOD_GIT_USER_NAME// /-}-$(echo ${GITPOD_WORKSPACE_CONTEXT} | jq -r .repository.name)"
# store the tailscale state into gitpod user
gp env TAILSCALE_STATE_MYPROJECT="$(sudo cat /var/lib/tailscale/tailscaled.state)"
fi
fi
# extra extensions we share
vscode:
extensions:
- redhat.vscode-yaml
- ms-azuretools.vscode-docker
- ms-kubernetes-tools.vscode-kubernetes-tools
- ms-vscode.makefile-tools
- bungcip.better-toml
- sleistner.vscode-fileutils
- esbenp.prettier-vscode
- darkriszty.markdown-table-prettify