AreejMehboob commited on
Commit
55b8190
·
verified ·
1 Parent(s): a80cc1e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -23
Dockerfile CHANGED
@@ -3,7 +3,8 @@ FROM python:3.13.4-slim
3
  # Set environment variables
4
  ENV HF_HOME=/app/.cache/huggingface \
5
  PYTHONUNBUFFERED=1 \
6
- HOME=/app
 
7
 
8
  # Set working directory
9
  WORKDIR /app
@@ -15,36 +16,22 @@ RUN apt-get update && apt-get install -y \
15
  git \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- # Create app user and group for better security
19
- RUN groupadd -r appuser && useradd -r -g appuser appuser
20
-
21
- # Create necessary directories with proper permissions
22
  RUN mkdir -p /app/.cache/huggingface/transformers \
23
  && mkdir -p /app/.streamlit \
24
- && mkdir -p /app/temp \
25
- && mkdir -p /app/src
26
 
27
- # Copy files first
28
  COPY requirements.txt ./
29
  COPY src/ ./src/
30
 
31
- # Install Python dependencies
32
- RUN pip install --no-cache-dir -r requirements.txt
33
-
34
- # Fix permissions for Qdrant database directory
35
- # This is the key fix for your issue
36
  RUN if [ -d "/app/src/qdrant_data_tesla" ]; then \
37
- chmod -R 755 /app/src/qdrant_data_tesla && \
38
- find /app/src/qdrant_data_tesla -type f -exec chmod 644 {} \; && \
39
- find /app/src/qdrant_data_tesla -type d -exec chmod 755 {} \; && \
40
- rm -f /app/src/qdrant_data_tesla/.lock; \
41
  fi
42
 
43
- # Change ownership of the entire app directory to appuser
44
- RUN chown -R appuser:appuser /app
45
-
46
- # Switch to non-root user
47
- USER appuser
48
 
49
  # Expose Streamlit's default port
50
  EXPOSE 8501
@@ -53,4 +40,4 @@ EXPOSE 8501
53
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
54
 
55
  # Start the Streamlit app
56
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.enableXsrfProtection=false", "--server.port=8501", "--server.address=0.0.0.0"]
 
3
  # Set environment variables
4
  ENV HF_HOME=/app/.cache/huggingface \
5
  PYTHONUNBUFFERED=1 \
6
+ HOME=/app \
7
+ TMPDIR=/tmp
8
 
9
  # Set working directory
10
  WORKDIR /app
 
16
  git \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Create necessary directories
 
 
 
20
  RUN mkdir -p /app/.cache/huggingface/transformers \
21
  && mkdir -p /app/.streamlit \
22
+ && chmod -R 755 /app
 
23
 
24
+ # Copy files
25
  COPY requirements.txt ./
26
  COPY src/ ./src/
27
 
28
+ # Fix permissions for the qdrant database folder
 
 
 
 
29
  RUN if [ -d "/app/src/qdrant_data_tesla" ]; then \
30
+ chmod -R 777 /app/src/qdrant_data_tesla; \
 
 
 
31
  fi
32
 
33
+ # Install Python dependencies
34
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
35
 
36
  # Expose Streamlit's default port
37
  EXPOSE 8501
 
40
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
41
 
42
  # Start the Streamlit app
43
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py","--server.enableXsrfProtection=false","--server.port=8501", "--server.address=0.0.0.0"]