#!/bin/bash docker_run() { # If the auth sock is empty just mount random shit I dont fucking care. [ -z "$SSH_AUTH_SOCK" ] && SSH_AUTH_SOCK=$(mktemp) # Allow docker to forward some x shit. xhost +local:docker # Run the devenv docker run -it --rm \ -u "${UID}:${GID}" \ -v ~/.bashrc:/home/x/.bashrc \ -v ~/.kube:/home/x/.kube \ -v ~/.ssh:/home/x/.ssh \ -v ${SSH_AUTH_SOCK}:/run/user/${UID}/ssh-agent.socket \ -v ~/.gitconfig:/home/x/.gitconfig \ -v ~/.config/git:/home/x/.config/git \ -v $HOME/Projects:/home/x/Projects \ -v $HOME/Scripts:/home/x/Scripts \ -v ${HOME}/.Xauthority:/home/x/.Xauthority \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e DISPLAY=${DISPLAY} \ --device /dev/dri \ --group-add video \ -v /var/run/docker.sock:/var/run/docker.sock \ --entrypoint /usr/bin/tmux \ d:${1} } docker_build() { # --network=host prevent stupid docker shit breaking yay if [ $1 == "base" ] ; then docker build --network=host ./${1} -t d:${1} else # Need base installed first dur docker build --network=host ./base -t d:base docker build --network=host ./${1} -t d:${1} fi } case "$1" in *) docker_build $1 && docker_run $1 ;; esac