Update ttyd

This commit is contained in:
Mo 2022-08-20 21:03:14 +02:00
parent 3bdce816c2
commit 4cb73c95f7
3 changed files with 39 additions and 23 deletions
containers
images
volumes/traefik

View file

@ -19,4 +19,5 @@ podman-default-create \
$container_name \
--network traefik \
-v $container_home_dir:/home/student:Z \
-v ~/bin/linux_course:/usr/local/bin:z,ro \
localhost/ttyd:latest

View file

@ -1,35 +1,50 @@
#!/usr/bin/fish
if podman image exists ttyd
podman rmi ttyd
if not podman rmi ttyd
exit 1
end
end
buildah rm builder &>/dev/null
buildah from --pull --name builder docker.io/library/ubuntu:latest
buildah run builder -- apt update
buildah run builder -- apt dist-upgrade -y
buildah run builder -- apt install -y git fish python3
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest
buildah run builder -- apt install -y sudo software-properties-common
buildah run builder -- add-apt-repository -y ppa:neovim-ppa/stable
buildah run builder -- apt update
buildah run builder -- apt install neovim -y
buildah run builder -- dnf update -y
buildah run builder -- dnf install -y \
cargo \
cmatrix \
cowsay \
fish \
git \
git-lfs \
htop \
jq \
lolcat \
nano \
neovim \
openssh-clients \
openssl-devel \
passwd \
pipx \
procps-ng \
python3 \
python3-ipython \
rsync \
trash-cli \
util-linux
buildah run builder -- apt install -y build-essential cmake libjson-c-dev libwebsockets-dev
buildah run builder -- git clone https://github.com/tsl0922/ttyd.git /root/src/ttyd
buildah run builder -- mkdir -p /root/src/ttyd/build
buildah config --workingdir /root/src/ttyd/build builder
buildah run builder -- cmake ..
buildah run builder -- make
buildah run builder -- make install
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean all
buildah run builder -- apt autoremove -y
buildah run builder -- apt clean
set -l user_password "student:$STUDENT_USER_PASSWORD"
buildah run builder -- useradd student
buildah run builder -- bash -c "echo $user_password | chpasswd"
buildah run builder -- usermod -aG wheel student
buildah run builder -- adduser student
buildah run builder -- usermod -aG sudo student
buildah config --workingdir /home/student --cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -p 8080 -c $TTYD_USER:$TTYD_PASSWORD bash'" builder
buildah config \
--workingdir /home/student \
--cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -c $TTYD_USER:$TTYD_PASSWORD bash'" \
builder
buildah commit --rm builder ttyd

View file

@ -60,5 +60,5 @@ http:
ttyd{{ $num }}:
loadBalancer:
servers:
- url: http://ttyd{{ $num }}:8080
- url: http://ttyd{{ $num }}:7681
{{ end }}