@@ -3,42 +3,42 @@ FROM python:3.12-slim
33WORKDIR /app
44
55# Set environment variables
6- ENV APP_NAME=rag_chat_api
7- ENV PYTHONDONTWRITEBYTECODE=1
8- ENV PYTHONUNBUFFERED=1
6+ ENV APP_NAME=rag_chat_api \
7+ PYTHONDONTWRITEBYTECODE=1 \
8+ PYTHONUNBUFFERED=1 \
9+ # GOOGLE_API_KEY and GITHUB_TOKEN should be passed securely at runtime
10+ CHROMA_PATH=/app/db/chroma \
11+ DATA_STORE_PATH=/app/db/knowledge_base
912
1013# Install system dependencies
1114RUN apt-get update && apt-get install -y --no-install-recommends \
1215 build-essential \
1316 libmagic1 \
14- && apt-get clean \
1517 && rm -rf /var/lib/apt/lists/*
1618
1719# Create necessary directories with proper permissions
18- RUN mkdir -p db/chroma && \
19- chmod -R 755 db
20+ RUN mkdir -p /app/ db/chroma && \
21+ chmod -R 755 /app/ db
2022
21- # IMPORTANT: Copy and install requirements first
23+ # Copy and install requirements first to leverage caching
2224COPY requirements.txt .
2325RUN pip install --no-cache-dir -r requirements.txt
2426
2527# Copy pre-built ChromaDB (if it exists locally)
2628COPY db/chroma /app/db/chroma
27-
28- # Set proper permissions for the ChromaDB
2929RUN chmod -R 755 /app/db/chroma
3030
3131# Copy configuration files
32- COPY .env.prod . /.env.prod
33- COPY docker-entrypoint.sh . /
34- RUN chmod +x . /docker-entrypoint.sh
32+ COPY .env.prod /app /.env.prod
33+ COPY docker-entrypoint.sh /app /
34+ RUN chmod +x /app /docker-entrypoint.sh
3535
3636# Copy source code
37- COPY embeddings.py api.py . /
37+ COPY embeddings.py api.py /app /
3838
3939# Expose the API port
4040EXPOSE 8000
4141
4242# Command to run the application
43- ENTRYPOINT [". /docker-entrypoint.sh" ]
43+ ENTRYPOINT ["/app /docker-entrypoint.sh" ]
4444CMD ["uvicorn" , "api:app" , "--host" , "0.0.0.0" , "--port" , "8000" ]
0 commit comments