# Use an official Python runtime as the base image FROM python:3.10 # Set environment variables ENV NUMBA_DISABLE_JIT=1 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # Set the working directory in the container WORKDIR /app # Copy the Django project code into the container COPY . /app # Install OpenCV dependencies RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx apache2 libapache2-mod-wsgi-py3 # Copy the requirements file to the working directory COPY requirements.txt . # Install project dependencies RUN pip install --no-cache-dir -r requirements.txt # Collect static files RUN python manage.py collectstatic --noinput # Enable the Apache mod_wsgi module RUN a2enmod wsgi # Configure Apache COPY django.conf /etc/apache2/sites-available/ RUN a2ensite django.conf # Fix permissions and ownership for Apache RUN chown -R www-data:www-data /var/log/apache2 /var/lock/apache2 # Expose port 80 for Apache EXPOSE 80 # Start Apache when the container starts USER www-data CMD ["apachectl", "-D", "FOREGROUND"]