File size: 632 Bytes
c4b61f1 d4ed3b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | FROM python:3.9
# Create a user and set it up for running the application
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set the working directory for your app
WORKDIR /app
# Copy the requirements file and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . /app
# Use gunicorn to serve the application, specifying the number of workers and binding it to the correct port
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "app:app","--timeout","120"]
|