alaselababatunde commited on
Commit
4a789b6
·
1 Parent(s): ee335ff
Files changed (2) hide show
  1. Dockerfile +26 -1
  2. main.py +1 -1
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # ==============================================================
2
- # Tech Disciples AI Backend — Dockerfile
3
  # ==============================================================
4
 
5
  # Use lightweight official Python image
@@ -13,22 +13,47 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
13
  # Set work directory
14
  WORKDIR $APP_HOME
15
 
 
16
  # System dependencies
 
17
  RUN apt-get update && apt-get install -y \
18
  git \
19
  && rm -rf /var/lib/apt/lists/*
20
 
 
21
  # Copy requirement file first (for caching)
 
22
  COPY requirements.txt .
23
 
 
24
  # Install Python dependencies
 
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
 
27
  # Copy application files
 
28
  COPY . .
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  # Expose port for FastAPI
 
31
  EXPOSE 7860
32
 
 
33
  # Run the FastAPI app with Uvicorn
 
34
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # ==============================================================
2
+ # Tech Disciples AI Backend — Dockerfile (Authenticated Build)
3
  # ==============================================================
4
 
5
  # Use lightweight official Python image
 
13
  # Set work directory
14
  WORKDIR $APP_HOME
15
 
16
+ # --------------------------------------------------------------
17
  # System dependencies
18
+ # --------------------------------------------------------------
19
  RUN apt-get update && apt-get install -y \
20
  git \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # --------------------------------------------------------------
24
  # Copy requirement file first (for caching)
25
+ # --------------------------------------------------------------
26
  COPY requirements.txt .
27
 
28
+ # --------------------------------------------------------------
29
  # Install Python dependencies
30
+ # --------------------------------------------------------------
31
  RUN pip install --no-cache-dir -r requirements.txt
32
 
33
+ # --------------------------------------------------------------
34
  # Copy application files
35
+ # --------------------------------------------------------------
36
  COPY . .
37
 
38
+ # --------------------------------------------------------------
39
+ # Set up Hugging Face token (must be provided at runtime)
40
+ # --------------------------------------------------------------
41
+ # This expects the token to be passed in during container run:
42
+ # docker run -e HUGGINGFACEHUB_API_TOKEN=hf_xxx -p 7860:7860 techdisciplesai
43
+ ENV HUGGINGFACEHUB_API_TOKEN=""
44
+
45
+ # --------------------------------------------------------------
46
+ # Authenticate to Hugging Face Hub (non-interactive)
47
+ # --------------------------------------------------------------
48
+ RUN python -c "from huggingface_hub import login; import os; token=os.getenv('HUGGINGFACEHUB_API_TOKEN'); \
49
+ print('⚠️ No HF token set during build!' if not token else '✅ Hugging Face token configured.')"
50
+
51
+ # --------------------------------------------------------------
52
  # Expose port for FastAPI
53
+ # --------------------------------------------------------------
54
  EXPOSE 7860
55
 
56
+ # --------------------------------------------------------------
57
  # Run the FastAPI app with Uvicorn
58
+ # --------------------------------------------------------------
59
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py CHANGED
@@ -42,7 +42,7 @@ try:
42
 
43
 
44
  hf_pipeline = pipeline(
45
- "text-generation-inference",
46
  model=MODEL_NAME,
47
  device=DEVICE,
48
  max_new_tokens=1024,
 
42
 
43
 
44
  hf_pipeline = pipeline(
45
+ "text-generation",
46
  model=MODEL_NAME,
47
  device=DEVICE,
48
  max_new_tokens=1024,