Spaces:
Sleeping
Sleeping
Commit ·
e58a643
1
Parent(s): b6ced7a
Updated
Browse files- Dockerfile +27 -11
Dockerfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
# ==============================================================
|
| 2 |
-
# Tech Disciples AI Backend —
|
| 3 |
# ==============================================================
|
| 4 |
|
| 5 |
-
# Use official
|
| 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 |
-
#
|
|
|
|
|
|
|
| 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 |
-
#
|
|
|
|
|
|
|
| 24 |
RUN pip install --upgrade pip setuptools wheel
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Copy requirements file first (for caching)
|
|
|
|
| 27 |
COPY requirements.txt .
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
# Install remaining Python dependencies
|
| 33 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 34 |
|
| 35 |
-
#
|
|
|
|
|
|
|
| 36 |
COPY . .
|
| 37 |
|
| 38 |
-
#
|
|
|
|
|
|
|
| 39 |
EXPOSE 7860
|
| 40 |
|
| 41 |
-
#
|
|
|
|
|
|
|
| 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"]
|