File size: 908 Bytes
2a52a89
 
8686125
f1832de
 
8686125
2a52a89
 
8686125
2a52a89
 
 
8686125
 
 
 
2a52a89
 
8686125
95377e0
 
 
661ffd6
 
95377e0
 
 
 
c174e6c
8686125
 
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
FROM python:3.9

# Install system dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx

# Set the working directory
WORKDIR /code

# Copy requirements file and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the Gunicorn configuration file
COPY ./gunicorn_config.py /code/gunicorn_config.py

# Copy the rest of the application files
COPY . .

# Create a directory for the instance folder and set permissions
RUN mkdir -p /code/instance \
    && chmod 777 /code/instance \
    && mkdir -p /code/media \
    && chmod 777 /code/media \
    && chmod 777 /code

# Create a non-root user and switch to it
RUN useradd -ms /bin/bash myuser
USER myuser

# Command to run the application with Gunicorn and custom configuration
CMD ["gunicorn", "-b", "0.0.0.0:7860", "-c", "gunicorn_config.py", "main:app"]