Vexxxxxxxxxxxxx commited on
Commit
068f4df
·
verified ·
1 Parent(s): 5a7cba9

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +45 -0
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ # Avoid prompts from apt
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # 1. Install Ubuntu basics, Python, and Chrome dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ python3 \
9
+ python3-pip \
10
+ wget \
11
+ curl \
12
+ unzip \
13
+ xvfb \
14
+ libnss3 \
15
+ libgbm1 \
16
+ libasound2 \
17
+ sudo \
18
+ ttyd \
19
+ && apt-get clean
20
+
21
+ # 2. Install Google Chrome
22
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
23
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
24
+ && apt-get update && apt-get install -y google-chrome-stable
25
+
26
+ # 3. Create a user for Hugging Face (UID 1000)
27
+ # Hugging Face doesn't like running as root
28
+ RUN useradd -m -u 1000 user && \
29
+ echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/etc/sudoers
30
+ USER user
31
+ ENV HOME=/home/user \
32
+ PATH=/home/user/.local/bin:$PATH
33
+ WORKDIR $HOME/app
34
+
35
+ # 4. Setup the "Binary Hijack" script in the user's path
36
+ RUN mkdir -p $HOME/.local/bin && \
37
+ echo '#!/bin/bash\n/usr/bin/google-chrome-stable --no-sandbox --headless --disable-dev-shm-usage --disable-gpu "$@"' > $HOME/.local/bin/google-chrome && \
38
+ chmod +x $HOME/.local/bin/google-chrome
39
+
40
+ # 5. Expose the port Hugging Face requires
41
+ EXPOSE 7860
42
+
43
+ # 6. Start a web-based terminal on port 7860
44
+ # This keeps the container running and lets you type commands in your browser
45
+ CMD ["ttyd", "-p", "7860", "bash"]