alaselababatunde commited on
Commit
e58a643
·
1 Parent(s): b6ced7a
Files changed (1) hide show
  1. Dockerfile +27 -11
Dockerfile CHANGED
@@ -1,8 +1,8 @@
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
@@ -13,30 +13,46 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
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"]
 
1
  # ==============================================================
2
+ # Tech Disciples AI Backend — Dockerfile (Optimized)
3
  # ==============================================================
4
 
5
+ # Use official Python 3.10 slim image
6
  FROM python:3.10-slim
7
 
8
  # Set environment variables
 
13
  # Set working directory
14
  WORKDIR $APP_HOME
15
 
16
+ # -------------------------
17
+ # System dependencies
18
+ # -------------------------
19
  RUN apt-get update && apt-get install -y --no-install-recommends \
20
  git \
21
  curl \
22
  build-essential \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ # -------------------------
26
+ # Upgrade pip & essential build tools
27
+ # -------------------------
28
  RUN pip install --upgrade pip setuptools wheel
29
 
30
+ # -------------------------
31
+ # Install PyTorch (CPU-only)
32
+ # -------------------------
33
+ RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
34
+
35
+ # -------------------------
36
  # Copy requirements file first (for caching)
37
+ # -------------------------
38
  COPY requirements.txt .
39
 
40
+ # -------------------------
41
+ # Install Python dependencies
42
+ # -------------------------
 
43
  RUN pip install --no-cache-dir -r requirements.txt
44
 
45
+ # -------------------------
46
+ # Copy app code
47
+ # -------------------------
48
  COPY . .
49
 
50
+ # -------------------------
51
+ # Expose FastAPI port
52
+ # -------------------------
53
  EXPOSE 7860
54
 
55
+ # -------------------------
56
+ # Run the FastAPI app with Uvicorn
57
+ # -------------------------
58
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]