Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Last active November 3, 2022 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atinfinity/c26cc299291569bc7b63d33f3cdd89ce to your computer and use it in GitHub Desktop.
Save atinfinity/c26cc299291569bc7b63d33f3cdd89ce to your computer and use it in GitHub Desktop.
VHS Docker
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/*
#!/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
@atinfinity
Copy link
Author

VHSをDockerコンテナ上で試す

VHS https://github.com/charmbracelet/vhsをDockerコンテナ上で試す

Dockerイメージ作成

docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t vhs/ubuntu:22.04 .

Dockerコンテナ起動

./launch_container.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment