File size: 885 Bytes
bf0c9ea
42693f7
bf0c9ea
42693f7
 
870c988
bf0c9ea
42693f7
 
bf0c9ea
42693f7
 
bf0c9ea
 
 
42693f7
 
bf0c9ea
42693f7
870c988
bf0c9ea
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM python:3.9

# Create a non-root user for better security
RUN useradd -m -u 1000 user
USER user

# Add the user's local bin to the PATH. This is where pip installs executables.
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory inside the container
WORKDIR /app

# Copy only the requirements.txt first to leverage Docker layer caching
COPY --chown=user ./requirements.txt requirements.txt
# Install the dependencies specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of your application code into the container
COPY --chown=user . /app

# The CMD instruction tells Docker how to run your application.
# This command starts the Gunicorn server, binding it to port 7860 on all network interfaces,
# and points it to the 'app' object inside your 'app.py' file.
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]