File size: 1,885 Bytes
6e3dee1
d75ee3d
6e3dee1
 
63dfcde
6e3dee1
 
 
 
d75ee3d
 
 
 
6e3dee1
 
 
 
d75ee3d
 
6e3dee1
 
 
63dfcde
 
6e3dee1
 
 
 
 
 
 
 
 
 
 
63dfcde
6e3dee1
 
 
63dfcde
6e3dee1
662c0c9
 
66f8fc1
 
 
 
 
 
56069ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66f8fc1
6e3dee1
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
57
58
59
60
61
62
63
64
65
66
67
FROM nvidia/cuda:11.3.1-base-ubuntu20.04

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Europe/Paris

# Remove any third-party apt sources to avoid issues with expiring keys.
# Install some basic utilities
RUN rm -f /etc/apt/sources.list.d/*.list && \
    apt-get update && apt-get install -y --no-install-recommends \
    curl \
    ca-certificates \
    sudo \
    git \
    git-lfs \
    zip \
    unzip \
    htop \
    bzip2 \
    libx11-6 \
    build-essential \
    libsndfile-dev \
    software-properties-common \
    && rm -rf /var/lib/apt/lists/*

# Install Python 3.10 and pip
RUN add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update && apt-get install -y --no-install-recommends \
    python3.10 \
    python3.10-distutils \
    && rm -rf /var/lib/apt/lists/* && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
    python get-pip.py && \
    rm get-pip.py

# Set Python 3.10 as the default python version
RUN update-alternatives --set python3 /usr/bin/python3.10 && \
    update-alternatives --set python /usr/bin/python3.10

RUN apt-get update && apt-get install ffmpeg libsm6 libxext6  -y


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

CMD ["python", "main.py"]