Traffic-Safety / Dockerfile
WebashalarForML's picture
Update Dockerfile
d9ca66a verified
raw
history blame contribute delete
943 Bytes
FROM python:3.11-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PORT=7860
WORKDIR /app
# --- System dependencies (OpenCV, ffmpeg, etc.) ---
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
ca-certificates \
ffmpeg \
libgl1 \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
# --- Copy project ---
COPY . /app
# --- Create required folders for app.py ---
RUN mkdir -p /app/static/uploads /app/static/results
# --- Give write permissions (HF Spaces safe) ---
RUN chmod -R 777 /app/static/uploads /app/static/results
# --- Python tooling ---
RUN python -m pip install --upgrade pip setuptools wheel
# --- Install dependencies ---
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# --- HF Spaces port ---
EXPOSE 7860
# --- Run Flask-SocketIO app ---
CMD ["python", "-u", "app.py"]