Last active
November 3, 2022 01:28
-
-
Save atinfinity/c26cc299291569bc7b63d33f3cdd89ce to your computer and use it in GitHub Desktop.
VHS Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:22.04 | |
ARG UID=1000 | |
ARG GID=1000 | |
# add new sudo user | |
ENV USERNAME vhs | |
ENV HOME /home/$USERNAME | |
RUN useradd -m $USERNAME && \ | |
echo "$USERNAME:$USERNAME" | chpasswd && \ | |
usermod --shell /bin/bash $USERNAME && \ | |
usermod -aG sudo $USERNAME && \ | |
mkdir /etc/sudoers.d && \ | |
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ | |
chmod 0440 /etc/sudoers.d/$USERNAME && \ | |
usermod --uid $UID $USERNAME && \ | |
groupmod --gid $GID $USERNAME | |
# install package | |
RUN echo "Acquire::GzipIndexes \"false\"; Acquire::CompressionTypes::Order:: \"gz\";" > /etc/apt/apt.conf.d/docker-gzip-indexes | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
sudo \ | |
less \ | |
emacs \ | |
tmux \ | |
bash-completion \ | |
command-not-found \ | |
software-properties-common \ | |
curl \ | |
wget \ | |
coreutils \ | |
build-essential \ | |
git \ | |
git-lfs \ | |
python3-pip \ | |
libgl1-mesa-dev \ | |
gpg \ | |
cmake \ | |
libjson-c-dev \ | |
libwebsockets-dev \ | |
libnss3 \ | |
&& \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
USER $USERNAME | |
WORKDIR /home/$USERNAME | |
SHELL ["/bin/bash", "-l", "-c"] | |
RUN python3 -m pip install -U pip | |
RUN git clone https://github.com/tsl0922/ttyd.git -b 1.7.2 && \ | |
cd ttyd && \ | |
mkdir build && \ | |
cd build && \ | |
cmake -D CMAKE_BUILD_TYPE=Release .. && \ | |
make && \ | |
sudo make install | |
RUN sudo mkdir -p /etc/apt/keyrings && \ | |
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg | |
RUN echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list | |
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \ | |
vhs \ | |
ffmpeg \ | |
&& \ | |
sudo apt-get clean && \ | |
sudo rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
XSOCK=/tmp/.X11-unix | |
XAUTH=/tmp/.docker.xauth | |
touch $XAUTH | |
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - | |
docker run --privileged --rm -it \ | |
--volume=$XSOCK:$XSOCK:rw \ | |
--volume=$XAUTH:$XAUTH:rw \ | |
--volume=$HOME:$HOME \ | |
--shm-size=1gb \ | |
--env="XAUTHORITY=${XAUTH}" \ | |
--env="DISPLAY=${DISPLAY}" \ | |
--env=TERM=xterm-256color \ | |
--env=QT_X11_NO_MITSHM=1 \ | |
--net=host \ | |
vhs/ubuntu:22.04 \ | |
bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VHSをDockerコンテナ上で試す
VHS https://github.com/charmbracelet/vhsをDockerコンテナ上で試す
Dockerイメージ作成
Dockerコンテナ起動