Vitrous commited on
Commit
8caa6e7
·
verified ·
1 Parent(s): 88182e3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,10 +1,9 @@
1
  FROM python:3.9
 
2
  FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
3
 
4
  ARG DEBIAN_FRONTEND=noninteractive
5
 
6
- ENV PYTHONUNBUFFERED=1
7
-
8
  RUN apt-get update && apt-get install --no-install-recommends -y \
9
  build-essential \
10
  python3.9 \
@@ -13,20 +12,26 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
13
  ffmpeg \
14
  && apt-get clean && rm -rf /var/lib/apt/lists/*
15
 
16
- # Set HF_HOME environment variable to specify cache directory
17
- ENV HF_HOME=/code/.cache/huggingface
18
-
19
-
20
  WORKDIR /code
21
 
22
  COPY ./requirements.txt /code/requirements.txt
23
 
 
24
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
25
 
26
- COPY . .
27
 
28
- # Set permissions for cache directory
29
- RUN mkdir -p /code/.cache/huggingface/transformers \
30
- && chmod -R 777 /code/.cache/huggingface
 
 
 
 
 
 
 
 
 
 
31
 
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4"]
 
1
  FROM python:3.9
2
+
3
  FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
4
 
5
  ARG DEBIAN_FRONTEND=noninteractive
6
 
 
 
7
  RUN apt-get update && apt-get install --no-install-recommends -y \
8
  build-essential \
9
  python3.9 \
 
12
  ffmpeg \
13
  && apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
 
 
 
 
15
  WORKDIR /code
16
 
17
  COPY ./requirements.txt /code/requirements.txt
18
 
19
+ # For hugging face
20
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
21
 
 
22
 
23
+ #set up working directory
24
+ RUN useradd -m -u 1000 user
25
+
26
+ USER user
27
+
28
+ ENV HOME=/home/user \
29
+ PATH=/home/user/.local/bin:$PATH
30
+
31
+ WORKDIR $HOME/app
32
+
33
+ COPY --chown=user . $HOME/app
34
+ #end of dir set up
35
+
36
 
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4"]