File size: 1,742 Bytes
a47545a
8066ccb
0bbf454
f6648b0
8cd7201
a47545a
8cd7201
126e9e4
0bbf454
a47545a
126e9e4
 
0bbf454
f6648b0
8066ccb
 
0bbf454
f6648b0
4ab2b56
f73f222
a47545a
 
0bbf454
f6648b0
609217a
f73f222
28a782e
0bbf454
c8871ab
27e4dfd
c8871ab
0bbf454
f6648b0
 
 
 
0bbf454
f6648b0
 
 
0bbf454
 
 
 
 
f6648b0
 
 
 
0bbf454
 
daa972d
c8871ab
0bbf454
f6648b0
a47545a
 
 
81212b1
0bbf454
b636490
49fbcb5
126e9e4
0bbf454
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM python:3.11-slim


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


# Set working directory
WORKDIR /app


# Create writable directories
RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app


# Set environment variables
ENV TRANSFORMERS_CACHE=/app/.cache \
    HF_HOME=/app/.cache \
    CHROMADB_DISABLE_TELEMETRY=true


# Install dependencies from requirements.txt first
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt


# Install nltk and download punkt tokenizer once during build
RUN python -m nltk.downloader punkt punkt_tab


# βœ… STEP 1: Copy the source data and the Python script into the image
COPY ./combined_context.jsonl .
COPY ./create_granular_chunks.py .


# βœ… STEP 2: Run the script to generate the chunks file inside the image
RUN python create_granular_chunks.py


# βœ… STEP 3: The 'granular_chunks_improved.jsonl' now exists inside the image.
# We no longer need to copy it from our local machine.


# Note: As recommended before, 'llama-cpp-python' should be removed from requirements.txt
# to rely on the more stable, version-pinned installation below.
RUN pip install --no-cache-dir llama-cpp-python==0.2.61


# Copy the rest of the application code
COPY ./app ./app


# Download your fine-tuned TinyLlama GGUF model
RUN curl -fL -o /app/tinyllama_dop_q4_k_m.gguf \
    https://huggingface.co/Kalpokoch/FinetunedQuantizedTinyLama/resolve/main/tinyllama_dop_q4_k_m.gguf \
    && echo "βœ… TinyLlama model downloaded."


# Expose the application port
EXPOSE 7860


# Run the FastAPI application
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]