d221 commited on
Commit
9e32922
·
verified ·
1 Parent(s): 1250664

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -6
Dockerfile CHANGED
@@ -2,17 +2,30 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # System deps + non-root user
6
- RUN apt-get update && apt-get install -y git && \
7
- useradd -m appuser && chown -R appuser:appuser /app
8
 
 
 
 
 
 
 
 
 
 
9
  USER appuser
10
 
11
- # Python dependencies
12
  COPY requirements.txt .
13
- RUN pip install --no-cache-dir -r requirements.txt
14
 
15
- # App files
16
  COPY --chown=appuser:appuser . .
17
 
 
 
 
 
18
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Create user with proper PATH configuration
6
+ RUN useradd -m appuser && \
7
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/appuser/.bashrc
8
 
9
+ # System dependencies
10
+ RUN apt-get update && apt-get install -y git
11
+
12
+ # Set environment variables
13
+ #ENV PATH="/home/appuser/.local/bin:${PATH}" \
14
+ # PYTHONPATH="/app:${PYTHONPATH}" \
15
+ # PIP_NO_WARN_SCRIPT_LOCATION=0)
16
+
17
+ # Switch to non-root user
18
  USER appuser
19
 
20
+ # Install Python dependencies
21
  COPY requirements.txt .
22
+ RUN pip install --user --no-cache-dir -r requirements.txt
23
 
24
+ # Copy application files
25
  COPY --chown=appuser:appuser . .
26
 
27
+ # Verify uvicorn location
28
+ RUN which uvicorn && echo $PATH
29
+
30
+ # Launch command
31
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]