File size: 1,041 Bytes
9fcc41f
 
5fc0408
2f0c092
5fc0408
 
cf053f6
71694d5
eaca758
5fc0408
9fcc41f
 
5fc0408
9fcc41f
 
5fc0408
abf4f97
1bbcd61
573094f
 
5fc0408
abf4f97
dfc22dd
 
abf4f97
6f7851a
f15e88e
abf4f97
729014c
5fc0408
 
 
 
abf4f97
94f266a
5fc0408
b0bc1bf
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
FROM python:3.9

# Create a user with UID 1000
RUN useradd -m -u 1000 user

# Set the working directory and user environment variables
ENV HOME=/ \
    PATH=/bin:$PATH

# Copy the requirements file to the /code directory
COPY ./requirements.txt /code/requirements.txt

# Install the Python dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Create a directory for cache and set permissions
RUN mkdir -p /.cache && chmod 777 /.cache && chown user:user /.cache

RUN pwd && ls -l

# Create the database file and set permissions
RUN touch /app/users.db && chmod 777 /app/users.db && chown user:user /app/users.db

# Change ownership of mentor.txt and temp_mentor.txt
RUN chown user:user /app/mentor.txt /app/temp_mentor.txt

# Change ownership of the 'app' directory
RUN chown user:user /app

# Switch back to the user
USER user

# Set the working directory for the application
WORKDIR /app

# Start the application using gunicorn
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]