File size: 1,004 Bytes
b6e0c65
 
72800b1
b6e0c65
 
f7911f7
b6e0c65
 
 
 
 
f7911f7
 
b6e0c65
f7911f7
72800b1
 
f7911f7
 
b6e0c65
f7911f7
72800b1
f7911f7
 
e080a10
f7911f7
b6e0c65
 
ce53081
72800b1
b6e0c65
 
f7911f7
72800b1
b6e0c65
f7911f7
b6e0c65
72800b1
f7911f7
72800b1
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
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install required system libraries
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Create required directories for ChromaDB and HuggingFace
RUN mkdir -p /app/data/chroma_crop_rag /app/cache /app/chroma_storage

# Create a non-root user
RUN useradd -m appuser

# Change ownership of the relevant directories to the non-root user
RUN chown -R appuser:appuser /app

# Set environment variables
ENV HF_HOME=/app/cache
ENV CHROMA_PERSIST_DIR=/app/data/chroma_crop_rag
ENV CHROMA_DB_DIR=/app/chroma_storage

# Copy project files
COPY requirements.txt api.py config.py crop_disease_qa.json /app/

RUN pip install -U langchain-groq
# Install Python dependencies
RUN pip install --no-cache-dir python-multipart -r requirements.txt

# Switch to the non-root user
USER appuser

# Expose the default port
EXPOSE 7860

# Run the application
CMD ["python", "api.py"]