pseudotheos commited on
Commit
974a821
·
1 Parent(s): 9649a2f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -12
Dockerfile CHANGED
@@ -1,10 +1,6 @@
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
7
-
8
  # Set the working directory inside the container
9
  WORKDIR /app
10
 
@@ -12,19 +8,20 @@ WORKDIR /app
12
  COPY ./requirements.txt /app/
13
 
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}"
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
 
 
 
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
 
8
  COPY ./requirements.txt /app/
9
 
10
  # Install the dependencies
11
+ RUN apt-get update && apt-get install -y wget gnupg \
 
 
 
 
12
  && wget -O /tmp/NVIDIA-DOCKER-KEY https://nvidia.github.io/nvidia-docker/gpgkey \
13
  && apt-key add /tmp/NVIDIA-DOCKER-KEY \
14
  && rm -f /tmp/NVIDIA-DOCKER-KEY \
15
+ && wget -O /etc/apt/sources.list.d/nvidia-docker.list https://nvidia.github.io/nvidia-docker/$(. /etc/os-release; echo $ID$VERSION_ID)/nvidia-docker.list \
16
  && apt-get update && apt-get install -y nvidia-docker2
17
 
18
+ # Create a non-root user
19
+ RUN useradd -m appuser
20
+
21
+ # Grant necessary permissions to the non-root user
22
+ RUN chown -R appuser /app /usr/local/
23
+
24
+ USER appuser
25
 
26
  # Add uvicorn to the PATH
27
  ENV PATH="/home/appuser/.local/bin:${PATH}"