starkbyte45896's picture
Create Dockerfile
91967e7 verified
Raw History Blame Contribute Delete
725 Bytes
# Use a lightweight Python image
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Install system dependencies (OpenCV needs them)
RUN apt-get update && apt-get install -y \
build-essential \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Create working directory
WORKDIR /app
# Copy dependencies file first (better Docker caching)
COPY requirement.txt .
# Install Python dependencies
RUN pip install --upgrade pip && pip install -r requirement.txt
# Copy all project files
COPY . .
# Expose port for Hugging Face Spaces
EXPOSE $PORT
# Run your app
CMD ["python", "app.py"]