File size: 826 Bytes
31a2e2a |
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 Python 3.10.12 as the base image
FROM python:3.9.13
# Set the working directory to /code
WORKDIR /code
# Copy the requirements file into the container at /code/requirements.txt
COPY ./requirements.txt /code/requirements.txt
# Upgrade pip and install the dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create a non-root user with UID 1000
RUN useradd -m -u 1000 user
# Switch to the non-root user
USER user
# Set environment variables for the user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory for the application
WORKDIR $HOME/app
# Copy the local code into the container at /home/user/app
COPY --chown=user . $HOME/app
# Specify the command to run on container start
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|