File size: 1,074 Bytes
ca9772c
3ac2e81
ca9772c
 
bde9f5a
ca9772c
 
 
 
 
 
d1e5295
 
07b3e03
 
3ac2e81
07b3e03
ca9772c
 
 
 
 
 
d1e5295
 
ca9772c
3ac2e81
 
 
 
 
 
 
ea68ec0
 
 
 
3ac2e81
d1e5295
ca9772c
d1e5295
ea68ec0
3ac2e81
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
34
35
36
37
38
39
40
41
42
43
# 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"]