File size: 1,170 Bytes
a13fe0d
 
 
 
 
 
 
 
2b6cbf6
a13fe0d
2b6cbf6
 
 
 
a13fe0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a15342
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
# Use Python 3.13 slim as the base image
FROM python:3.13-slim

# Install git and other necessary packages
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Expose Groq and Tavily API keys at build time
RUN --mount=type=secret,id=GROQ_API_KEY,mode=0444,required=true \
    --mount=type=secret,id=TAVILY_API_KEY,mode=0444,required=true \
    git init && \
    git remote add origin-groq $(cat /run/secrets/GROQ_API_KEY) && \
    git remote add origin-tavily $(cat /run/secrets/TAVILY_API_KEY)


# Set the working directory
WORKDIR /app

# Create cache directory with proper permissions
RUN mkdir -p /.cache && chmod 777 /.cache

# Set environment variable for transformers cache
ENV TRANSFORMERS_CACHE=/.cache/transformers
ENV HF_HOME=/.cache/huggingface

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Download the BGE embedding model
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"

# Copy app folder
COPY app/ .

# Expose Gradio's default port
EXPOSE 7860

# Run the app
CMD ["python", "app.py"]