Spaces:
Paused
Paused
| FROM theasp/novnc:latest | |
| # 1. Setup specific environment variables for Spaces | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| DISPLAY_WIDTH=1280 \ | |
| DISPLAY_HEIGHT=720 \ | |
| # Spaces requires the web server to be on port 7860 | |
| vnc_port=7860 \ | |
| # Disable the default terminal if you want a cleaner look | |
| RUN_XTERM=yes \ | |
| RUN_FLUXBOX=yes | |
| # 2. Spaces requires a non-root user (ID 1000) | |
| # The base image uses root, so we need to create the user and fix permissions | |
| RUN useradd -m -u 1000 user && \ | |
| # Fix permissions for the app directory so the new user can run the entrypoint | |
| chown -R user:user /app && \ | |
| chown -R user:user /usr/share/novnc && \ | |
| # Give the user permission to write to necessary system folders used by the base image | |
| chmod -R 777 /var/log && \ | |
| chmod -R 777 /var/run | |
| # 3. Modify the internal service configuration to use Port 7860 instead of 8080 | |
| # The base image hardcodes 8080 in its supervisor config or entrypoint | |
| RUN sed -i 's/8080/7860/g' /app/supervisord.conf || true && \ | |
| sed -i 's/8080/7860/g' /app/entrypoint.sh || true | |
| # 4. Switch to the new user | |
| USER user | |
| ENV HOME=/home/user | |
| WORKDIR /home/user | |
| # 5. Install your specific app (Example: Firefox) | |
| # Note: We switch to root briefly for installation, then back to user | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| firefox-esr \ | |
| && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # 6. Expose the correct port | |
| EXPOSE 7860 | |
| # 7. Start the container | |
| CMD ["/app/entrypoint.sh"] |