Spaces:
Runtime error
Runtime error
File size: 1,104 Bytes
f84bf8a b999698 b143a6e f84bf8a fbccb62 f84bf8a 56aba29 | 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 33 | # Use a lightweight Python image
FROM python:3.9
# Install system dependencies required for OpenCV (libGL.so.1)
RUN apt-get update && apt-get install -y libgl1-mesa-glx
# Set environment variables so that configuration and cache directories are writable.
# MPLCONFIGDIR: For Matplotlib to write its configuration cache.
# YOLO_CONFIG_DIR: For Ultralytics YOLO to store its settings.
# XDG_CACHE_HOME: A fallback cache home used by Fontconfig and other libraries.
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV YOLO_CONFIG_DIR=/tmp/ultralytics
ENV XDG_CACHE_HOME=/tmp
# Set the working directory
WORKDIR /app
# Copy the requirements and install dependencies
COPY requirements.txt /app/
RUN pip install -r requirements.txt
# Copy the Django app files
COPY . /app/
# Ensure the database directory is writable
RUN mkdir -p /app/db && chmod 777 /app/db
# Expose the default Django port
EXPOSE 8000
# Run migrations and start Django application using Gunicorn
CMD ["sh", "-c", "python manage.py makemigrations && python manage.py migrate && gunicorn Crop_and_Weed_Detector.wsgi:application --bind 0.0.0.0:8000"]
|