Spaces:
Sleeping
Sleeping
Commit ·
6f8436d
1
Parent(s): 33b3aaa
fix: resolve externally-managed-environment error by using python venv in Docker
Browse files- Dockerfile +5 -2
Dockerfile
CHANGED
|
@@ -14,7 +14,7 @@ WORKDIR /app
|
|
| 14 |
# Install system deps
|
| 15 |
RUN apt-get update \
|
| 16 |
&& apt-get install -y --no-install-recommends \
|
| 17 |
-
python3 python3-pip ca-certificates curl build-essential \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
# Copy entire repo first
|
|
@@ -30,9 +30,12 @@ RUN npm ci --include=dev --no-audit --no-fund
|
|
| 30 |
# Build frontend
|
| 31 |
RUN npm run build
|
| 32 |
|
| 33 |
-
# Install backend dependencies if available
|
| 34 |
WORKDIR /app
|
| 35 |
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
| 36 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 37 |
pip install --no-cache-dir -r requirements.txt
|
| 38 |
|
|
|
|
| 14 |
# Install system deps
|
| 15 |
RUN apt-get update \
|
| 16 |
&& apt-get install -y --no-install-recommends \
|
| 17 |
+
python3 python3-pip python3-venv ca-certificates curl build-essential \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
# Copy entire repo first
|
|
|
|
| 30 |
# Build frontend
|
| 31 |
RUN npm run build
|
| 32 |
|
| 33 |
+
# Install backend dependencies if available (using virtual environment)
|
| 34 |
WORKDIR /app
|
| 35 |
COPY requirements.txt .
|
| 36 |
+
RUN python3 -m venv /opt/venv
|
| 37 |
+
ENV PATH="/opt/venv/bin:$PATH"
|
| 38 |
+
|
| 39 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 40 |
pip install --no-cache-dir -r requirements.txt
|
| 41 |
|