FROM python:3.9 # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory and Gensim data directory ENV HOME=/home/user \ GENSIM_DATA_DIR=/home/user/gensim-data \ PATH=/home/user/.local/bin:$PATH # Set the working directory to the user's home directory WORKDIR $HOME/app # Upgrade pip and install dependencies COPY --chown=user ./Api/requirements.txt /home/user/app/requirements.txt RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir --upgrade -r /home/user/app/requirements.txt # Install additional packages USER root RUN apt update && apt install -y ffmpeg USER user # Copy the application code and set the owner to the user COPY --chown=user ./Api/src /home/user/app/src # Expose the port the app runs on EXPOSE 8000 # Command to run the application CMD ["uvicorn", "app.api:app", "--host", "0.0.0.0", "--port", "8000"]