dracoox commited on
Commit
0eafabe
·
verified ·
1 Parent(s): 410fbfd

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +61 -0
Dockerfile ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ # Install all required tools
6
+ RUN apt update && apt upgrade -y && \
7
+ apt install -y \
8
+ sudo \
9
+ curl \
10
+ wget \
11
+ git \
12
+ gnupg \
13
+ openssh-client \
14
+ neofetch \
15
+ tmate \
16
+ python3 \
17
+ python3-pip \
18
+ ca-certificates \
19
+ software-properties-common \
20
+ build-essential \
21
+ procps \
22
+ apache2 \
23
+ xz-utils \
24
+ net-tools
25
+
26
+ # Clean up
27
+ RUN apt clean && rm -rf /var/lib/apt/lists/*
28
+
29
+ # Install Node.js v22 and latest npm
30
+ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
31
+ apt install -y nodejs && npm install -g npm
32
+
33
+ # Install speedtest-cli
34
+ RUN pip3 install speedtest-cli
35
+
36
+ # Create user draco with password draco
37
+ RUN useradd -m -s /bin/bash draco && echo "draco:draco" | chpasswd && usermod -aG sudo draco
38
+ RUN usermod -u 1000 draco
39
+
40
+ # SSH keygen for tmate
41
+ RUN mkdir -p /home/draco/.ssh && \
42
+ ssh-keygen -t rsa -f /home/draco/.ssh/id_rsa -N '' && \
43
+ chown -R draco:draco /home/draco/.ssh
44
+
45
+ USER draco
46
+ WORKDIR /home/draco
47
+
48
+ # Hugging Face requires something to run on port 7860
49
+ RUN echo "<h1>Session is running</h1>" > index.html
50
+ EXPOSE 7860
51
+
52
+ # Run tmate in background, auto-restarting if it crashes, and a webserver to stay alive
53
+ CMD bash -c '\
54
+ while true; do \
55
+ tmate -S /tmp/tmate.sock new-session -d; \
56
+ tmate -S /tmp/tmate.sock wait tmate-ready; \
57
+ sleep 10; \
58
+ while pgrep -f "tmate -S /tmp/tmate.sock" > /dev/null; do sleep 5; done; \
59
+ echo "Tmate exited. Restarting..."; \
60
+ done & \
61
+ python3 -m http.server 7860'