Kalpokoch commited on
Commit
2ef592d
Β·
verified Β·
1 Parent(s): 1a0416e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -21
Dockerfile CHANGED
@@ -1,66 +1,50 @@
1
  FROM python:3.11-slim
2
 
3
-
4
  # Install required system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  git curl build-essential cmake \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
-
10
  # Set working directory
11
  WORKDIR /app
12
 
13
-
14
  # Create writable directories
15
  RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app
16
 
17
-
18
  # Set environment variables
19
  ENV TRANSFORMERS_CACHE=/app/.cache \
20
  HF_HOME=/app/.cache \
21
  CHROMADB_DISABLE_TELEMETRY=true
22
 
23
-
24
  # Install dependencies from requirements.txt first
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
-
29
  # Install nltk and download punkt tokenizer once during build
30
  RUN python -m nltk.downloader punkt punkt_tab
31
 
32
-
33
  # βœ… STEP 1: Copy the source data and the Python script into the image
34
  COPY ./combined_context.jsonl .
35
  COPY ./create_granular_chunks.py .
36
 
37
-
38
  # βœ… STEP 2: Run the script to generate the chunks file inside the image
39
  RUN python create_granular_chunks.py
40
 
41
-
42
- # βœ… STEP 3: The 'granular_chunks_improved.jsonl' now exists inside the image.
43
- # We no longer need to copy it from our local machine.
44
-
45
-
46
  # Note: As recommended before, 'llama-cpp-python' should be removed from requirements.txt
47
  # to rely on the more stable, version-pinned installation below.
48
  RUN pip install --no-cache-dir llama-cpp-python==0.2.61
49
 
50
-
51
- # Copy the rest of the application code
52
- COPY ./app/app.py ./app/
53
- COPY ./app/policy_vector_db.py ./app/
54
 
55
  # Download your fine-tuned TinyLlama GGUF model
56
  RUN curl -fL -o /app/tinyllama_dop_q4_k_m.gguf \
57
  https://huggingface.co/Kalpokoch/FinetunedQuantizedTinyLama/resolve/main/tinyllama_dop_q4_k_m.gguf \
58
  && echo "βœ… TinyLlama model downloaded."
59
 
60
-
61
  # Expose the application port
62
  EXPOSE 7860
63
 
64
-
65
- # Run the FastAPI application
66
- CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.11-slim
2
 
 
3
  # Install required system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  git curl build-essential cmake \
6
  && rm -rf /var/lib/apt/lists/*
7
 
 
8
  # Set working directory
9
  WORKDIR /app
10
 
 
11
  # Create writable directories
12
  RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app
13
 
 
14
  # Set environment variables
15
  ENV TRANSFORMERS_CACHE=/app/.cache \
16
  HF_HOME=/app/.cache \
17
  CHROMADB_DISABLE_TELEMETRY=true
18
 
 
19
  # Install dependencies from requirements.txt first
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
 
23
  # Install nltk and download punkt tokenizer once during build
24
  RUN python -m nltk.downloader punkt punkt_tab
25
 
 
26
  # βœ… STEP 1: Copy the source data and the Python script into the image
27
  COPY ./combined_context.jsonl .
28
  COPY ./create_granular_chunks.py .
29
 
 
30
  # βœ… STEP 2: Run the script to generate the chunks file inside the image
31
  RUN python create_granular_chunks.py
32
 
 
 
 
 
 
33
  # Note: As recommended before, 'llama-cpp-python' should be removed from requirements.txt
34
  # to rely on the more stable, version-pinned installation below.
35
  RUN pip install --no-cache-dir llama-cpp-python==0.2.61
36
 
37
+ # βœ… FIXED: Copy the application files directly to /app (not /app/app/)
38
+ COPY ./app/app.py .
39
+ COPY ./app/policy_vector_db.py .
 
40
 
41
  # Download your fine-tuned TinyLlama GGUF model
42
  RUN curl -fL -o /app/tinyllama_dop_q4_k_m.gguf \
43
  https://huggingface.co/Kalpokoch/FinetunedQuantizedTinyLama/resolve/main/tinyllama_dop_q4_k_m.gguf \
44
  && echo "βœ… TinyLlama model downloaded."
45
 
 
46
  # Expose the application port
47
  EXPOSE 7860
48
 
49
+ # βœ… FIXED: Run the FastAPI application with correct module path
50
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]