pseudotheos commited on
Commit
9649a2f
·
1 Parent(s): 856cbd8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -5
Dockerfile CHANGED
@@ -1,9 +1,6 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Use an official Python runtime as a parent image
5
- FROM python:3.9-slim
6
-
7
  # Create a non-root user
8
  RUN useradd -m appuser
9
  USER appuser
@@ -17,6 +14,18 @@ COPY ./requirements.txt /app/
17
  # Install the dependencies
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  # Add uvicorn to the PATH
21
  ENV PATH="/home/appuser/.local/bin:${PATH}"
22
 
@@ -26,5 +35,5 @@ COPY . /app/
26
  # Create a writable cache directory inside the /app directory
27
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
28
 
29
- # Specify the command to run your application using NVIDIA Container Toolkit and uvicorn
30
- CMD ["nvidia-docker", "run", "--rm", "-p", "8000:8000", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
 
 
 
4
  # Create a non-root user
5
  RUN useradd -m appuser
6
  USER appuser
 
14
  # Install the dependencies
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Add NVIDIA Docker repository and install NVIDIA Docker
18
+ RUN distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
19
+ && apt-get update && apt-get install -y wget gnupg \
20
+ && wget -O /tmp/NVIDIA-DOCKER-KEY https://nvidia.github.io/nvidia-docker/gpgkey \
21
+ && apt-key add /tmp/NVIDIA-DOCKER-KEY \
22
+ && rm -f /tmp/NVIDIA-DOCKER-KEY \
23
+ && wget -O /etc/apt/sources.list.d/nvidia-docker.list https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list \
24
+ && apt-get update && apt-get install -y nvidia-docker2
25
+
26
+ # Add NVIDIA Docker to the PATH
27
+ ENV PATH="/usr/bin/nvidia-docker:${PATH}"
28
+
29
  # Add uvicorn to the PATH
30
  ENV PATH="/home/appuser/.local/bin:${PATH}"
31
 
 
35
  # Create a writable cache directory inside the /app directory
36
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
37
 
38
+ # Specify the command to run your application
39
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]