TrafficPulse / Dockerfile
Anshul005's picture
Deploy TrafficPulse app with Dockerfile and start.sh
9d645ea
2 — Replace/update your Dockerfile (copy this exact version)
This is a robust, minimal Dockerfile that:
uses a modern slim base,
updates packages,
installs small system libs (ffmpeg, libgl1) for computer-vision tasks,
installs pip deps from Requirements.txt,
copies code and runs app.py.
Create/replace Dockerfile with:
# Use newer Debian-based Python slim
FROM python:3.11-slim-bookworm
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
# Install system deps (ffmpeg for video, git if needed, libs for OpenCV)
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
git \
ffmpeg \
build-essential \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps
COPY Requirements.txt /app/Requirements.txt
RUN python -m pip install --upgrade pip \
&& pip install --no-cache-dir -r /app/Requirements.txt
# Copy project files
COPY . /app
# Expose port (Streamlit default; Hugging Face will map its port)
ENV PORT=7860
EXPOSE 7860
# Use start.sh if present, otherwise run wrapper app.py
# If you added start.sh earlier, use that; otherwise run app.py directly.
CMD ["bash", "-lc", "if [ -x ./start.sh ]; then ./start.sh; else python app.py; fi"]