File size: 1,623 Bytes
3b8d04f
e11256b
 
 
6a3e660
e11256b
37aaad7
e11256b
6a3e660
 
 
 
3b8d04f
6a3e660
 
e11256b
6a3e660
e11256b
 
 
6a3e660
3b8d04f
e11256b
 
3b8d04f
5eb15d7
 
 
 
3b8d04f
 
58e3a83
e11256b
3b8d04f
 
 
 
 
6a3e660
3b8d04f
cbaf699
 
 
3b8d04f
 
e11256b
de99466
1489e52
e11256b
3b8d04f
e11256b
 
3b8d04f
c50308e
468aa68
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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"]