# Use the official PyTorch image as the base FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime # Set up a new user named "hyathi" with user ID 1000 RUN useradd -m -u 1000 hyathi RUN usermod -aG sudo hyathi # Install sudo and add user to sudoers group RUN apt update -y && apt install -y sudo # Allow the user to run apt commands without a password prompt by modifying sudoers file RUN echo "hyathi ALL=(ALL) NOPASSWD: /usr/bin/apt, /bin/rm" >> /etc/sudoers # Switch to the new user USER hyathi # Set home to the user's home directory ENV HOME=/home/hyathi \ PATH=/home/hyathi/.local/bin:$PATH # Set the working directory WORKDIR $HOME/app # Environment dependencies ENV TRANSFORMERS_CACHE=$HOME/app/models ENV HF_HOME=$HOME/app/models ENV AUTOT_CACHE=$HOME/app/models ENV PYANNOTE_CACHE=$HOME/app/models/pyannote # Copy all necessary files COPY --chown=hyathi . $HOME/app # Installing all necessary dependencies and running the application with a personalized Hugging-Face-Token RUN sudo apt update -y && sudo apt upgrade -y && \ sudo apt install -y libsm6 libxrender1 libfontconfig1 && \ sudo apt clean && \ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Update Conda and install libsndfile # RUN sudo conda update --all && \ # sudo conda install -c conda-forge libsndfile && \ # sudo conda clean --all -y # Install Python dependencies from requirements.txt RUN pip install --no-cache-dir -r requirements.txt WORKDIR $HOME/app RUN ls # Expose the port for the app EXPOSE 7860 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]