NicheBean commited on
Commit
2fedb3c
·
verified ·
1 Parent(s): 8feefbd

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official linuxserver/webtop Ubuntu XFCE image as the base
2
+ FROM lscr.io/linuxserver/webtop:ubuntu-xfce
3
+
4
+ # Hugging Face Spaces runs as user 1000 by default
5
+ # Webtop also uses PUID 1000 by default, so we align them
6
+ ENV PUID=1000
7
+ ENV PGID=1000
8
+ ENV TZ=Etc/UTC
9
+
10
+ # Hugging Face Spaces expects the app to listen on port 7860
11
+ # Webtop listens on 3000 by default, so we'll map it
12
+ EXPOSE 7860
13
+
14
+ # Install any additional tools if needed (optional)
15
+ # RUN apt-get update && apt-get install -y vim git curl
16
+
17
+ # Use a custom entrypoint or modify the existing one to change the port
18
+ # The linuxserver/webtop image uses s6-overlay, we can change the port via environment variable
19
+ ENV SUBFOLDER=/
20
+ ENV TITLE=Ubuntu-XFCE
21
+
22
+ # We use a simple socat or similar to redirect 7860 to 3000 if the image doesn't support PORT env
23
+ # But linuxserver webtop actually supports changing the port via the internal config
24
+ # However, the easiest way for HF is to just redirect the port or use the internal setting if available.
25
+ # Let's use a simple redirection to ensure it works on HF's expected port.
26
+ RUN apt-get update && apt-get install -y socat
27
+
28
+ # Create a startup script to run both the init and the port forwarder
29
+ RUN echo '#!/bin/bash\n\
30
+ socat TCP-LISTEN:7860,fork,reuseaddr TCP:localhost:3000 & \n\
31
+ exec /init' > /entrypoint.sh && chmod +x /entrypoint.sh
32
+
33
+ ENTRYPOINT ["/entrypoint.sh"]