LinuxOssss / Dockerfile
NicheBean's picture
Create Dockerfile
2fedb3c verified
Raw History Blame Contribute Delete
1.36 kB
# Use the official linuxserver/webtop Ubuntu XFCE image as the base
FROM lscr.io/linuxserver/webtop:ubuntu-xfce
# Hugging Face Spaces runs as user 1000 by default
# Webtop also uses PUID 1000 by default, so we align them
ENV PUID=1000
ENV PGID=1000
ENV TZ=Etc/UTC
# Hugging Face Spaces expects the app to listen on port 7860
# Webtop listens on 3000 by default, so we'll map it
EXPOSE 7860
# Install any additional tools if needed (optional)
# RUN apt-get update && apt-get install -y vim git curl
# Use a custom entrypoint or modify the existing one to change the port
# The linuxserver/webtop image uses s6-overlay, we can change the port via environment variable
ENV SUBFOLDER=/
ENV TITLE=Ubuntu-XFCE
# We use a simple socat or similar to redirect 7860 to 3000 if the image doesn't support PORT env
# But linuxserver webtop actually supports changing the port via the internal config
# However, the easiest way for HF is to just redirect the port or use the internal setting if available.
# Let's use a simple redirection to ensure it works on HF's expected port.
RUN apt-get update && apt-get install -y socat
# Create a startup script to run both the init and the port forwarder
RUN echo '#!/bin/bash\n\
socat TCP-LISTEN:7860,fork,reuseaddr TCP:localhost:3000 & \n\
exec /init' > /entrypoint.sh && chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]