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
