Spaces:
Paused
Paused
File size: 1,506 Bytes
fef6880 1126f67 4577340 fef6880 1126f67 fef6880 4577340 1126f67 4577340 1126f67 78a7df4 1126f67 4577340 1126f67 5714937 4577340 1126f67 fef6880 4577340 1126f67 ce18556 1126f67 78a7df4 1126f67 78a7df4 1126f67 ce18556 4577340 1126f67 5714937 4577340 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # 1. Use Debian Bullseye (Stable Linux)
# This ensures Python and Tkinter match perfectly to prevent the 503 crash.
FROM debian:bullseye
# 2. Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# 3. Install Python, Tkinter, and GUI tools
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-tk \
xvfb \
x11vnc \
fluxbox \
novnc \
net-tools \
scrot \
&& rm -rf /var/lib/apt/lists/*
# 4. Fix the 403 Error (Missing Index)
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
# 5. Set up work directory
WORKDIR /app
# 6. Copy files
COPY . .
# 7. Install Python requirements
# CORRECTION: Removed '--break-system-packages' which causes errors on Bullseye
RUN pip3 install --no-cache-dir -r requirements.txt
# 8. Create the user (ID 1000)
RUN useradd -m -u 1000 user
# 9. GENERATE STARTUP SCRIPT
RUN echo '#!/bin/bash' > start.sh && \
echo 'export DISPLAY=:1' >> start.sh && \
echo 'Xvfb :1 -screen 0 1440x960x24 &' >> start.sh && \
echo 'sleep 2' >> start.sh && \
echo 'fluxbox &' >> start.sh && \
echo 'python3 main.py &' >> start.sh && \
echo 'x11vnc -display :1 -nopw -forever -quiet &' >> start.sh && \
echo '/usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 7860' >> start.sh && \
chmod +x start.sh
# 10. Fix permissions
RUN chown -R user:user /app
# 11. Switch to user and run
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
CMD ["./start.sh"] |