samim2024 commited on
Commit
7a3ba0e
·
verified ·
1 Parent(s): d4c3edd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -18
Dockerfile CHANGED
@@ -1,34 +1,34 @@
1
- # Use an official Python image
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
 
 
7
 
8
- # Set working directory
 
9
  WORKDIR /app
10
 
11
- # Install system dependencies
12
- RUN apt-get update && apt-get install -y \
13
  build-essential \
14
  libglib2.0-0 \
15
  libsm6 \
16
  libxext6 \
17
  libxrender-dev \
18
- && rm -rf /var/lib/apt/lists/*
19
-
20
- # Copy requirements first to leverage Docker cache
21
- COPY requirements.txt .
22
 
23
  # Install Python dependencies
24
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
25
 
26
- # Copy the rest of the application code
27
  COPY . .
28
 
29
- # Expose ports (8501 for Streamlit, 8000 for FastAPI)
30
- EXPOSE 8501
31
- EXPOSE 8000
32
 
33
- # Set entrypoint to run both Streamlit and FastAPI
34
- CMD ["sh", "-c", "streamlit run app.py & uvicorn api:app --host 0.0.0.0 --port 8000"]
 
1
+ # Use official slim Python base image
2
  FROM python:3.10-slim
3
 
4
+ # Environment settings
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1 \
7
+ TRANSFORMERS_CACHE=/tmp/huggingface \
8
+ HF_HOME=/tmp/huggingface
9
 
10
+ # Create cache and working directories
11
+ RUN mkdir -p /tmp/huggingface /app/data /app/vectorstore
12
  WORKDIR /app
13
 
14
+ # Install OS dependencies
15
+ RUN apt-get update && apt-get install -y --no-install-recommends \
16
  build-essential \
17
  libglib2.0-0 \
18
  libsm6 \
19
  libxext6 \
20
  libxrender-dev \
21
+ && rm -rf /var/lib/apt/lists/*
 
 
 
22
 
23
  # Install Python dependencies
24
+ COPY requirements.txt .
25
+ RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
26
 
27
+ # Copy application code
28
  COPY . .
29
 
30
+ # Expose ports for Streamlit and FastAPI
31
+ EXPOSE 8501 8000
 
32
 
33
+ # Run both Streamlit and FastAPI
34
+ CMD ["sh", "-c", "streamlit run app.py & exec uvicorn api:app --host 0.0.0.0 --port 8000"]