File size: 1,448 Bytes
1eda840
07631e1
c5bae6e
 
 
1eda840
 
 
 
 
c5bae6e
1eda840
 
 
c5bae6e
 
 
 
1eda840
dd68bba
aa3372c
1eda840
dd68bba
1eda840
 
ee9c80c
dd68bba
ee9c80c
dd68bba
 
b16aa9b
1eda840
c5bae6e
29b4fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04

# Set the environment variable to noninteractive to avoid tzdata prompts
ENV DEBIAN_FRONTEND=noninteractive

# Install Python and other dependencies
RUN apt-get update && apt-get install -y \
    python3.10 \
    python3-pip \
    ffmpeg \
    tzdata \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Configure the timezone (change to your preferred timezone)
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
    dpkg-reconfigure --frontend noninteractive tzdata

# Set up the working directory
WORKDIR /app

# Copy the requirements file and install dependencies
COPY ./requirements.txt /app/requirements.txt
RUN python3 -m pip install --upgrade pip \
    && python3 -m pip install --no-cache-dir --upgrade -r /app/requirements.txt

# Add and configure the user
RUN useradd -m -u 1000 user

# Set environment variables for the user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    CUDA_HOME=/

# Set the user and working directory
USER user
WORKDIR $HOME/app

# Copy the application code
COPY --chown=user . $HOME/app

# Ensure the user has the correct permissions
RUN chmod -R 777 $HOME/app

# Set additional environment variables
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
ENV PATH="/opt/venv/bin:$PATH"

# Set the command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]