dembasowmr commited on
Commit
c5b8eb4
·
1 Parent(s): 61044c2

Fix: Add .local/bin to PATH for uvicorn and other installed executables

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -4
Dockerfile CHANGED
@@ -15,24 +15,26 @@ RUN apt-get update && apt-get install -y \
15
  tesseract-ocr-tur \
16
  tesseract-ocr-ara \
17
  tesseract-ocr-fra \
 
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
  # Create the user
21
  RUN useradd -m -u 1000 user
22
 
23
  # IMPORTANT: Change ownership of the /app directory to the new 'user'
24
- # This allows the 'user' to write files and create subdirectories within /app.
25
  RUN chown -R user:user /app
26
 
27
  # Switch to the non-root user. All subsequent commands (COPY, RUN for pip, CMD) will be executed as 'user'.
28
  USER user
29
 
 
 
 
30
  # Set the Hugging Face cache directory to a path where the 'user' has write permissions.
31
  ENV HF_HOME=/app/huggingface_cache
32
 
33
- # Create the cache directory (now /app is owned by 'user', so this should work)
34
- # The chown user:user $HF_HOME is technically redundant if /app is owned by user, but harmless.
35
- RUN mkdir -p $HF_HOME # Removed chown here, as its handled by /app ownership.
36
 
37
  # Copy requirements.txt and install Python dependencies
38
  COPY --chown=user:user requirements.txt .
 
15
  tesseract-ocr-tur \
16
  tesseract-ocr-ara \
17
  tesseract-ocr-fra \
18
+ # Add other languages if needed
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
  # Create the user
22
  RUN useradd -m -u 1000 user
23
 
24
  # IMPORTANT: Change ownership of the /app directory to the new 'user'
 
25
  RUN chown -R user:user /app
26
 
27
  # Switch to the non-root user. All subsequent commands (COPY, RUN for pip, CMD) will be executed as 'user'.
28
  USER user
29
 
30
+ # IMPORTANT: Add /home/user/.local/bin to the PATH for the 'user'
31
+ ENV PATH="/home/user/.local/bin:$PATH"
32
+
33
  # Set the Hugging Face cache directory to a path where the 'user' has write permissions.
34
  ENV HF_HOME=/app/huggingface_cache
35
 
36
+ # Create the cache directory
37
+ RUN mkdir -p $HF_HOME
 
38
 
39
  # Copy requirements.txt and install Python dependencies
40
  COPY --chown=user:user requirements.txt .