Dockerfile46 lines · 1003 chars FROM python:3.11-slim-bullseye
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# System dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
make \
cmake \
pkg-config \
ffmpeg \
libsm6 \
libxext6 \
libxrender1 \
libjpeg-dev \
libpng-dev \
libtiff5-dev \
zlib1g-dev \
libgl1-mesa-dev \
python3-tk \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt .
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Create a non-root user and switch to it for running the app
RUN useradd -m -d /home/appuser -s /bin/bash appuser && \
chown -R appuser:appuser /app
USER appuser
# Default command
CMD ["python", "run.py"]