Rúben Almeida commited on
Commit
f52ae75
·
1 Parent(s): 6493993

Add USER instruction to dockerfile to address .cache permission issues

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -3
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,7 +1,14 @@
1
  FROM python:3.13-slim
2
 
 
 
 
 
 
 
 
3
  # Set the working directory
4
- WORKDIR /app
5
 
6
  RUN apt-get update && apt-get install -y build-essential
7
 
@@ -14,13 +21,13 @@ RUN pip install -U setuptools wheel
14
  RUN pip install -U torch torchvision torchaudio
15
 
16
  # Copy the requirements file into the container
17
- COPY requirements.txt .
18
 
19
  # Install the dependencies
20
  RUN pip install -U --no-cache-dir -r requirements.txt
21
 
22
  # Copy the rest of the application code into the container
23
- COPY . .
24
 
25
  EXPOSE 7860
26
 
 
1
  FROM python:3.13-slim
2
 
3
+ RUN useradd -m -u 1000 user
4
+
5
+ USER user
6
+
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
  # Set the working directory
11
+ WORKDIR $HOME/app
12
 
13
  RUN apt-get update && apt-get install -y build-essential
14
 
 
21
  RUN pip install -U torch torchvision torchaudio
22
 
23
  # Copy the requirements file into the container
24
+ COPY --chown=user requirements.txt .
25
 
26
  # Install the dependencies
27
  RUN pip install -U --no-cache-dir -r requirements.txt
28
 
29
  # Copy the rest of the application code into the container
30
+ COPY --chown=user . .
31
 
32
  EXPOSE 7860
33
 
requirements.txt CHANGED
@@ -5,7 +5,7 @@ torchaudio
5
  setuptools
6
  wheel
7
  pydantic
8
- fastapi[standard]>=0.115.12
9
  transformers
10
  huggingface_hub
11
  autoawq>=0.2.8
 
5
  setuptools
6
  wheel
7
  pydantic
8
+ fastapi[standard]
9
  transformers
10
  huggingface_hub
11
  autoawq>=0.2.8