Ubuntushell / Dockerfile
Vexxxxxxxxxxxxx's picture
Update Dockerfile
84a1cf7 verified
Raw
History Blame Contribute Delete
1.47 kB
FROM ubuntu:22.04
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# 1. Install Ubuntu basics, Python, and Chrome dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
wget \
curl \
unzip \
xvfb \
libnss3 \
libgbm1 \
libasound2 \
sudo \
ttyd \
gnupg \
&& apt-get clean
# 2. Install Google Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y google-chrome-stable
# 3. Create a user for Hugging Face (UID 1000)
# FIXED: Changed /etc/etc/sudoers to /etc/sudoers
RUN useradd -m -u 1000 user && \
echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# 4. Setup the "Binary Hijack" script
# This ensures Chrome always runs with the necessary VPS flags
RUN mkdir -p $HOME/.local/bin && \
echo '#!/bin/bash\n/usr/bin/google-chrome-stable --no-sandbox --headless --disable-dev-shm-usage --disable-gpu "$@"' > $HOME/.local/bin/google-chrome && \
chmod +x $HOME/.local/bin/google-chrome
# 5. Hugging Face uses port 7860
EXPOSE 7860
# 6. Start the web terminal
# This keeps the Space alive and gives you a terminal in your browser
CMD ["ttyd", "-p", "7860", "bash"]