FROM python:3.10 # Install Google Chrome RUN apt-get update && apt-get install -y wget gnupg2 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list RUN apt-get update && apt-get install -y google-chrome-stable WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # 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 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 current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # Install the ML models RUN mkdir -p /home/user/app/cv_files/ && \ curl -L https://huggingface.co/datasets/Kyo-Kai/Fsg_pp_files/resolve/main/AniClassifier.pt?download=true -o /home/user/app/cv_files/AniClassifier.pt && \ curl -L https://huggingface.co/datasets/Kyo-Kai/Fsg_pp_files/resolve/main/AniFaceDet.pt?download=true -o /home/user/app/cv_files/AniFaceDet.pt # Give executable permissions to chromedriver RUN chmod +x $HOME/app/driver/chromedriver # Run the python file CMD ["uvicorn", "Fsg_pp:app", "--host", "0.0.0.0", "--port", "7860"]