Spaces:
Running
Running
File size: 1,294 Bytes
b5047c3 437bfba b5047c3 437bfba 079a0c1 b5047c3 437bfba 079a0c1 cbff5ad 437bfba b5047c3 079a0c1 437bfba b5047c3 437bfba b5047c3 079a0c1 437bfba cbff5ad faae826 437bfba cbff5ad 079a0c1 cbff5ad 079a0c1 |
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 |
# Use Ubuntu 22.04 for compatibility with pygobject and toga
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV DISPLAY=:99
ENV PATH="/home/user/.local/bin:$PATH"
# Install system dependencies as root
RUN apt-get update && apt-get install -y \
python3 \
python3-dev \
python3-pip \
python3-venv \
libgirepository1.0-dev \
libcairo2-dev \
pkg-config \
meson \
ninja-build \
libgtk-3-dev \
xvfb \
x11vnc \
novnc \
websockify \
nginx \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
WORKDIR /app
# Copy application files
COPY --chown=user . /app
# Create and activate a virtual environment
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install flask pygobject toga
# Copy Nginx configuration
COPY --chown=user nginx.conf /etc/nginx/nginx.conf
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Start Xvfb, x11vnc, noVNC, Nginx, and Flask app
CMD Xvfb :99 -screen 0 1024x768x16 & \
x11vnc -display :99 -forever -nopw & \
websockify --web /usr/share/novnc 6080 localhost:5900 & \
nginx & \
python3 app.py |