devcom33 commited on
Commit
093c950
·
1 Parent(s): 1f6b7e0

Updated FastAPI code

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -3
Dockerfile CHANGED
@@ -18,7 +18,6 @@ RUN mkdir -p /tmp/huggingface /tmp/matplotlib
18
  RUN chown -R app:app /tmp/huggingface /tmp/matplotlib
19
 
20
  # Copy source code and set ownership
21
- # Do this before switching user
22
  COPY . .
23
  RUN chown -R app:app /app
24
 
@@ -26,8 +25,10 @@ RUN chown -R app:app /app
26
  USER app
27
 
28
  # Set environment variables
29
- # Add the user's local bin to the PATH
30
- ENV PATH=/home/app/.local/bin:$PATH
 
 
31
  ENV HF_HOME=/tmp/huggingface
32
  ENV HF_HUB_CACHE=/tmp/huggingface
33
  ENV TRANSFORMERS_CACHE=/tmp/huggingface
 
18
  RUN chown -R app:app /tmp/huggingface /tmp/matplotlib
19
 
20
  # Copy source code and set ownership
 
21
  COPY . .
22
  RUN chown -R app:app /app
23
 
 
25
  USER app
26
 
27
  # Set environment variables
28
+ # 1. Add user's local bin to the PATH for executables (like uvicorn)
29
+ # 2. Add user's site-packages to PYTHONPATH for module imports
30
+ ENV PATH="/home/app/.local/bin:${PATH}"
31
+ ENV PYTHONPATH="/home/app/.local/lib/python3.10/site-packages"
32
  ENV HF_HOME=/tmp/huggingface
33
  ENV HF_HUB_CACHE=/tmp/huggingface
34
  ENV TRANSFORMERS_CACHE=/tmp/huggingface