Spaces:
Sleeping
Sleeping
File size: 794 Bytes
47526b2 660f597 3034ae6 0396dd2 c4f3e32 5468d69 c4f3e32 5468d69 47526b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Use Python as the base image
FROM python:3.8
# Set the working directory
WORKDIR /app
# Copy the project files
COPY . /app
# Ensure writable directories exist at build time
RUN mkdir -p /app/static && chmod -R 777 /app/static
# Install system dependencies for OpenCV, GL, and FontConfig
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
fontconfig && \
rm -rf /var/lib/apt/lists/* # Clean up to reduce image size
# Set environment variables to fix Matplotlib cache errors
ENV MPLCONFIGDIR=/app/matplotlib_cache
RUN mkdir -p /app/matplotlib_cache && chmod -R 777 /app/matplotlib_cache
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose port 7860
EXPOSE 7860
# Run the Flask app
CMD ["python", "app.py"]
|