CrashVisionAI / Dockerfile
webapp1's picture
Update Dockerfile
d67ae34 verified
Raw
History Blame Contribute Delete
920 Bytes
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# FIX: Use 'libgl1' instead of the deprecated 'libgl1-mesa-glx'
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
build-essential \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary folders and set permissions
RUN mkdir -p uploads models templates
RUN chmod 777 uploads
# Copy the rest of the application
COPY app.py .
COPY templates/index.html ./templates/
# Note: Ensure you upload your model files to the /models folder in your HF Repo
COPY models/ ./models/
# Hugging Face Spaces run on port 7860
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]