FROM alexanderkoch1/genesis-training:latest

			USER root
			RUN mkdir -p /tmp; chmod 1777 /tmp; exit 0;
			RUN export DEBIAN_FRONTEND=noninteractive; apt-get update || echo 'V220614a: error during apt-get update!';
			RUN export DEBIAN_FRONTEND=noninteractive; for x in {0..30}; do apt-get install --no-install-recommends -y openssh-server tmux git wget curl less locales sudo software-properties-common rsync && break; sleep 1; done; exit 0;
			RUN export DEBIAN_FRONTEND=noninteractive; \
				env >> /etc/environment; \
				echo VAST_CONTAINERLABEL='"$(cat ~/.vast_containerlabel)"' >> /root/.bashrc; \
				sed -i "s/StrictModes yes/StrictModes no/g" /etc/ssh/sshd_config; \
				echo ClientAliveInterval 10 >> /etc/ssh/sshd_config; \
				echo ClientAliveCountMax 2 >> /etc/ssh/sshd_config; \
				echo UsePAM no >> /etc/ssh/sshd_config; \
				echo PasswordAuthentication no >> /etc/ssh/sshd_config; \
				echo ChallengeResponseAuthentication no >> /etc/ssh/sshd_config; \
				echo Banner /etc/banner >> /etc/ssh/sshd_config; \
        sed -i '/^[ \t]*LogLevel /d' /etc/ssh/sshd_config; \
        echo 'LogLevel VERBOSE' >> /etc/ssh/sshd_config; \
				echo 'Welcome to vast.ai. If authentication fails, try again after a few seconds, and double check your ssh key.' > /etc/banner ; \
				echo 'Have fun!' >> /etc/banner
				RUN echo 'PS1="\[\e]0;\u@$VAST_CONTAINERLABEL: \w\a\]\[\e[01;34m\]\u\[\e[m\e[01m\]@\[\e[01;36m\]$VAST_CONTAINERLABEL\[\e[m\e[01m\]:\[\e[01;37m\]\w\$\[\e[m\] " ; if [ ! -e "$HOME/.no_auto_tmux" ] && [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ] && [ "$TMUX_STARTED" = "" ]; then tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux; exit; elif ! [[ -z "$TMUX" ]]; then echo '"'"'Welcome to your vast.ai container! This session is running in `tmux`.'"'"'; echo '"'"'To disconnect without closing your processes, press ctrl+b, release, then d.'"'"'; echo '"'"'To disable auto-tmux, run `touch ~/.no_auto_tmux` and reconnect. See also https://tmuxcheatsheet.com/'"'"'; fi; ' >> ~/.bashrc
		ENTRYPOINT while [ ! -e /.launch ]; do sleep 1; done; bash /.launch