FROM python:3.9 # Create a new group and user RUN groupadd -g 1000 StefanG2002 && \ useradd -m -u 1000 -g StefanG2002 StefanG2002 # Set ownership and permissions for the home directory RUN chown -R StefanG2002:StefanG2002 /home/StefanG2002 && \ chmod -R 755 /home/StefanG2002 # Switch to the newly created user USER StefanG2002 # Set environment variables ENV HOME=/home/StefanG2002 \ PATH=/home/StefanG2002/.local/bin:$PATH WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt COPY . . CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]