saakshigupta commited on
Commit
e84eb9a
·
verified ·
1 Parent(s): 7f0a708

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -3
Dockerfile CHANGED
@@ -6,14 +6,20 @@ RUN apt-get update && apt-get install -y \
6
  git \
7
  && rm -rf /var/lib/apt/lists/*
8
 
 
 
 
9
  # Set working directory
10
  WORKDIR /app
11
 
12
- # Create a directory for Triton cache with proper permissions
13
- RUN mkdir -p /app/.triton && chmod 777 /app/.triton
 
14
 
15
- # Set environment variable to use the custom Triton cache directory
16
  ENV TRITON_CACHE_DIR=/app/.triton
 
 
17
 
18
  # Copy requirements first to leverage Docker cache
19
  COPY requirements.txt .
@@ -24,6 +30,12 @@ RUN pip install --no-cache-dir -r requirements.txt
24
  # Copy the rest of the application
25
  COPY . .
26
 
 
 
 
 
 
 
27
  # Expose the port Streamlit runs on
28
  EXPOSE 8501
29
 
 
6
  git \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
+ # Create a user with explicit UID 1000 (common for first non-root user)
10
+ RUN useradd -m -u 1000 appuser
11
+
12
  # Set working directory
13
  WORKDIR /app
14
 
15
+ # Create directories for various caches with proper permissions
16
+ RUN mkdir -p /app/.triton /app/.torch_cache && \
17
+ chown -R appuser:appuser /app
18
 
19
+ # Set environment variables for cache directories
20
  ENV TRITON_CACHE_DIR=/app/.triton
21
+ ENV TORCH_HOME=/app/.torch_cache
22
+ ENV TORCHINDUCTOR_CACHE_DIR=/app/.torch_cache/inductor
23
 
24
  # Copy requirements first to leverage Docker cache
25
  COPY requirements.txt .
 
30
  # Copy the rest of the application
31
  COPY . .
32
 
33
+ # Ensure proper ownership of all files
34
+ RUN chown -R appuser:appuser /app
35
+
36
+ # Switch to the appuser
37
+ USER appuser
38
+
39
  # Expose the port Streamlit runs on
40
  EXPOSE 8501
41