webrtc1 / Dockerfile
Alvin3y1's picture
Update Dockerfile
279fca8 verified
FROM python:3.11-slim-bullseye
ENV DEBIAN_FRONTEND=noninteractive
# Install System Dependencies
# Added: libturbojpeg0 (Critical for fast JPEG encoding)
RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb \
x11-utils \
x11-xserver-utils \
xdotool \
dbus-x11 \
plasma-desktop \
kwin-x11 \
build-essential \
pkg-config \
python3-dev \
libffi-dev \
libx11-dev \
libxrandr2 \
libxtst6 \
libxext-dev \
libxrender-dev \
libturbojpeg0 \
curl \
wget \
procps \
&& rm -rf /var/lib/apt/lists/*
# Setup User
# We create a user to avoid running X11/Pulse/Plasma as root (which causes issues)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
DISPLAY=:99
WORKDIR $HOME/app
# Install Python Dependencies
# Ensure requirements.txt includes: PyTurboJPEG, mss, aiohttp, aiortc, psutil, python-xlib, Pillow
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy Application Code
COPY --chown=user:user app.py .
EXPOSE 7860
CMD ["python", "app.py"]