Spaces:
Sleeping
Sleeping
File size: 767 Bytes
d9bbb32 a04465e d9bbb32 daeb340 a04465e d9bbb32 48ea472 d9bbb32 daeb340 a04465e d9bbb32 daeb340 a04465e d9bbb32 daeb340 d9bbb32 daeb340 d9bbb32 daeb340 d9bbb32 daeb340 d9bbb32 daeb340 d9bbb32 |
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 |
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /code
# Copy the requirements file into the container
COPY requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Add a user with a home directory
RUN useradd -m -u 1000 user
# Switch to the new user
USER user
# Define environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the rest of the application code and change ownership
COPY --chown=user . $HOME/app
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|