Update Dockerfile
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
|
@@ -12,6 +12,7 @@ RUN npm install --frozen-lockfile
|
|
| 12 |
COPY frontend/ ./
|
| 13 |
RUN npm run build
|
| 14 |
|
|
|
|
| 15 |
# --- Stage 2: GPU-enabled Python backend ---
|
| 16 |
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 AS backend
|
| 17 |
|
|
@@ -22,6 +23,11 @@ ENV DEBIAN_FRONTEND=noninteractive \
|
|
| 22 |
PIP_NO_CACHE_DIR=1 \
|
| 23 |
HF_HOME=/app/.cache/huggingface
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Create non-root user
|
| 26 |
RUN useradd -m appuser
|
| 27 |
|
|
@@ -32,13 +38,10 @@ RUN mkdir -p /app/.cache/huggingface && \
|
|
| 32 |
# Switch to non-root user
|
| 33 |
USER appuser
|
| 34 |
|
| 35 |
-
# Install Python and system dependencies
|
| 36 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 37 |
-
python3 python3-pip python3-venv git curl && \
|
| 38 |
-
rm -rf /var/lib/apt/lists/*
|
| 39 |
-
|
| 40 |
WORKDIR /app
|
| 41 |
|
|
|
|
|
|
|
| 42 |
# Upgrade pip and install CUDA-enabled PyTorch
|
| 43 |
RUN python3 -m pip install --upgrade pip && \
|
| 44 |
python3 -m pip install --index-url https://download.pytorch.org/whl/cu121 torch==2.4.1+cu121
|
|
|
|
| 12 |
COPY frontend/ ./
|
| 13 |
RUN npm run build
|
| 14 |
|
| 15 |
+
# --- Stage 2: GPU-enabled Python backend ---
|
| 16 |
# --- Stage 2: GPU-enabled Python backend ---
|
| 17 |
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 AS backend
|
| 18 |
|
|
|
|
| 23 |
PIP_NO_CACHE_DIR=1 \
|
| 24 |
HF_HOME=/app/.cache/huggingface
|
| 25 |
|
| 26 |
+
# Install Python and system dependencies BEFORE switching user
|
| 27 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 28 |
+
python3 python3-pip python3-venv git curl && \
|
| 29 |
+
rm -rf /var/lib/apt/lists/*
|
| 30 |
+
|
| 31 |
# Create non-root user
|
| 32 |
RUN useradd -m appuser
|
| 33 |
|
|
|
|
| 38 |
# Switch to non-root user
|
| 39 |
USER appuser
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
WORKDIR /app
|
| 42 |
|
| 43 |
+
# Continue with pip installs and app setup...
|
| 44 |
+
|
| 45 |
# Upgrade pip and install CUDA-enabled PyTorch
|
| 46 |
RUN python3 -m pip install --upgrade pip && \
|
| 47 |
python3 -m pip install --index-url https://download.pytorch.org/whl/cu121 torch==2.4.1+cu121
|