Spaces:
Running
Running
File size: 709 Bytes
a0c14f1 e77a86f a0c14f1 e77a86f a0c14f1 e77a86f a0c14f1 e77a86f a0c14f1 e77a86f 960fa1d b757a3b |
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 |
# Use the official lightweight Python image.
FROM python:3.11
# Allow statements and log messages to immediately appear in the logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
# Install production dependencies.
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set work directory
WORKDIR $APP_HOME
# Change ownership of app files to the new user
COPY --chown=user . $HOME/app
# Run the web service on container startup.
CMD exec gunicorn --bind 0.0.0.0:7860 --workers 4 --threads 16 main:app
|