zka-detection-full / Dockerfile
root16285
Fix: Replace libgl1-mesa-glx with libgl1 for Debian compatibility
a400715
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
wget \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir fastapi uvicorn[standard]==0.32.0 python-multipart websockets
# Copy the entire application
COPY . /app
# Download YOLOv5 model if not present
RUN if [ ! -f yolov5s.pt ]; then \
wget -q https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5s.pt; \
fi
# Create user for security
RUN useradd -m -u 1000 user && chown -R user:user /app
USER user
# Set environment variables
ENV PATH="/home/user/.local/bin:$PATH"
ENV PORT=7860
# Expose the port
EXPOSE 7860
# Start the FastAPI application
CMD ["sh", "-c", "cd /app/webapp/backend && uvicorn main:app --host 0.0.0.0 --port 7860"]