alaselababatunde commited on
Commit
b6ced7a
·
1 Parent(s): 572435e
Files changed (2) hide show
  1. Dockerfile +17 -9
  2. requirements.txt +0 -1
Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
  # ==============================================================
2
- # Tech Disciples AI Backend — Dockerfile
3
  # ==============================================================
4
 
5
- # Use lightweight official Python image
6
  FROM python:3.10-slim
7
 
8
  # Set environment variables
@@ -10,25 +10,33 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
10
  PYTHONUNBUFFERED=1 \
11
  APP_HOME=/app
12
 
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 — Optimized Dockerfile
3
  # ==============================================================
4
 
5
+ # Use official slim Python 3.10 image
6
  FROM python:3.10-slim
7
 
8
  # Set environment variables
 
10
  PYTHONUNBUFFERED=1 \
11
  APP_HOME=/app
12
 
13
+ # Set working directory
14
  WORKDIR $APP_HOME
15
 
16
+ # Install system dependencies
17
+ RUN apt-get update && apt-get install -y --no-install-recommends \
18
  git \
19
+ curl \
20
+ build-essential \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Upgrade pip
24
+ RUN pip install --upgrade pip setuptools wheel
25
+
26
+ # Copy requirements file first (for caching)
27
  COPY requirements.txt .
28
 
29
+ # Install heavy packages separately first (torch) for reliability
30
+ RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
31
+
32
+ # Install remaining Python dependencies
33
  RUN pip install --no-cache-dir -r requirements.txt
34
 
35
+ # Copy application code
36
  COPY . .
37
 
38
  # Expose port for FastAPI
39
  EXPOSE 7860
40
 
41
+ # Start FastAPI with Uvicorn
42
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
requirements.txt CHANGED
@@ -1,6 +1,5 @@
1
  fastapi>=0.101.0
2
  uvicorn[standard]>=0.23.0
3
- torch>=2.1.0
4
  transformers>=4.40.0
5
  accelerate>=0.25.0
6
  langchain>=1.0.0
 
1
  fastapi>=0.101.0
2
  uvicorn[standard]>=0.23.0
 
3
  transformers>=4.40.0
4
  accelerate>=0.25.0
5
  langchain>=1.0.0