File size: 1,203 Bytes
ea09322
 
2867943
ea09322
 
7ef71d7
ea09322
 
 
2867943
ea09322
 
 
2867943
5adda8d
5438345
2867943
5adda8d
 
2867943
5438345
2867943
5adda8d
2867943
 
7ef71d7
ea09322
 
7ef71d7
ea09322
 
2867943
5438345
66e19fe
 
5438345
2867943
5adda8d
2867943
 
6850eb4
ea09322
2867943
6850eb4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM python:3.9-slim

# Set working directory to /app inside the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create directories for cache and streamlit config
RUN mkdir -p /app/.streamlit /app/.cache

# Set environment variables for caching
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_HOME=/app/.cache
ENV TORCH_HOME=/app/.cache

# Copy .streamlit config folder (including config.toml)
COPY .streamlit/ .streamlit/

# Copy app files (chromadb_model is already in the Space repository)
COPY app/ ./
COPY requirements.txt ./

# Install Python dependencies
RUN pip3 install -r requirements.txt

# Set environment variables for Streamlit
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false

# Expose port 8501 (Streamlit Spaces requirement)
EXPOSE 8501

# Healthcheck endpoint for Spaces
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

# Run Streamlit (let it use default port 8501)
ENTRYPOINT ["streamlit", "run", "main.py", "--server.address=0.0.0.0"]