File size: 1,002 Bytes
398624a
5ddcb18
39b6d10
 
5ddcb18
 
 
 
 
 
b404604
 
 
 
 
9cee656
b404604
c598589
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ddcb18
c6d1697
 
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
FROM docker.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04@sha256:8f9dd0d09d3ad3900357a1cf7f887888b5b74056636cd6ef03c160c3cd4b1d95

RUN apt-get update && apt-get install -y python3 python3-pip

WORKDIR /code

COPY ./requirements.txt /code/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Install PyTorch for GPU check
RUN pip install --no-cache-dir torch torchvision

# Add and run the GPU check script
COPY gpu_check.py /code/gpu_check.py
RUN python3 /code/gpu_check.py

# 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 ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]