File size: 940 Bytes
ff17fc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.9

# Create a non-root user with a home directory
RUN useradd -m -u 1000 user

# Set the user to the non-root user
USER user

# Add the user's local bin to the PATH
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory to /app
WORKDIR /app

# Copy the requirements.txt file and install any dependencies
COPY --chown=user ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Copy the current directory contents into the container at /app
COPY --chown=user . /app

# Create the folders for uploads and results with appropriate permissions
RUN mkdir -p /app/static/uploads /app/static/results && \
    chmod -R 755 /app/static/uploads /app/static/results

# Expose the port the app will run on
EXPOSE 7860

# Run the Flask app using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]