#!/bin/bash -i LOCATION="${LOCATION:=$(pwd)}" ACTIVE_CONTAINER_ID=$(docker ps -aqf "name=devenv") NOCACHE="" if [ "$1" == "rebuild" ] ; then NOCACHE="--no-cache" fi docker build $NOCACHE --platform linux/amd64 -t devenv - <> /root/.profile RUN echo -e '\n. /root/.asdf/completions/asdf.bash' >> /root/.bashrc # Set environment variables for all shells ENV PATH="/root/.asdf/shims:/root/.asdf/bin:/root/.local/bin:./node_modules/.bin:${PATH}" ENV EDITOR=nvim RUN echo 'source ~/.config/.env' >> /root/.profile RUN curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher RUN fisher install rstacruz/fish-asdf RUN echo "N" ENV KERL_BUILD_DOCS=yes RUN asdf plugin add elixir RUN asdf plugin add erlang RUN asdf install erlang 27.2 RUN asdf install elixir 1.18.4-otp-27 RUN asdf global erlang 27.2 RUN asdf global elixir 1.18.4-otp-27 RUN mkdir /home/build/ RUN ln -s /root/.asdf/installs/elixir/1.18.4-otp-27/ /home/build/elixir RUN mix local.rebar --force RUN mix local.hex --force RUN pipx install pyright RUN pipx install shell-gpt RUN pipx install ruff RUN pipx install mypy RUN pipx install virtualenv RUN pipx install basedpyright RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ unzip awscliv2.zip && \ ./aws/install && \ rm -rf awscliv2.zip aws/ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ apt update && \ apt install gh -y RUN curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg && \ echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | tee /etc/apt/sources.list.d/clickhouse.list && \ apt update && \ apt install -y clickhouse-client WORKDIR /root/work CMD tmux -u new-session EOF mkdir -p $HOME/.local/share/fish/ touch $HOME/.local/share/fish/fish_history touch $HOME/.config/.env if [ -n "$NOCACHE" ] then docker kill $ACTIVE_CONTAINER_ID docker rm $ACTIVE_CONTAINER_ID ACTIVE_CONTAINER_ID="" fi if [ -z "$ACTIVE_CONTAINER_ID" ] then ACTIVE_CONTAINER_ID=$( docker run \ --platform linux/amd64 \ -v "$HOME/.local/share/fish/fish_history:/root/.local/share/fish/fish_history" \ -v "$HOME/.ssh":/root/.ssh \ -v "$HOME/.aws":/root/.aws \ -v "$HOME/.config/github-copilot":/root/.config/github-copilot/ \ -v "$HOME/.config/.env":/root/.config/.env \ -v "$LOCATION:/root/work/" \ -v /var/run/docker.sock:/var/run/docker.sock \ --network host \ --name devenv \ -d \ -it \ devenv ) fi docker start $ACTIVE_CONTAINER_ID docker exec -it $ACTIVE_CONTAINER_ID tmux attach-session || docker exec -it $ACTIVE_CONTAINER_ID tmux -u new-session