update
This commit is contained in:
@@ -25,12 +25,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
# Copy requirements first so this layer is cached unless deps change
|
# Copy requirements first so this layer is cached unless deps change
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
# Build wheel files for all dependencies AND their transitive dependencies.
|
# FIX: Create an isolated venv to compile wheels so Kaniko doesn't corrupt global pip vendor files
|
||||||
# --wheel-dir=/wheels: write .whl files to the wheelhouse directory
|
RUN python -m venv /opt/wheelhouse-env && \
|
||||||
# (no --no-deps: we want the full dependency tree pre-compiled)
|
/opt/wheelhouse-env/bin/pip install --no-cache-dir --upgrade pip && \
|
||||||
# RUN python -m pip install --no-cache-dir --upgrade pip && \
|
/opt/wheelhouse-env/bin/pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt
|
||||||
# python -m pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt
|
|
||||||
RUN python -m pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Stage 2: Application Builder
|
# Stage 2: Application Builder
|
||||||
# Creates a venv and installs dependencies from the local wheelhouse.
|
# Creates a venv and installs dependencies from the local wheelhouse.
|
||||||
@@ -79,11 +78,6 @@ FROM python:3.12-slim-bookworm AS runtime
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Create non-root user
|
|
||||||
# RUN groupadd -r appgroup && useradd -r -g appgroup -d /app -s /sbin/nologin appuser
|
|
||||||
|
|
||||||
# # Copy the entire venv from builder
|
|
||||||
# COPY --from=builder --chown=appuser:appgroup /opt/venv /opt/venv
|
|
||||||
# Step 2: Assign an explicit numeric ID (like 999) when creating the user/group
|
# Step 2: Assign an explicit numeric ID (like 999) when creating the user/group
|
||||||
RUN groupadd -g 999 appgroup && \
|
RUN groupadd -g 999 appgroup && \
|
||||||
useradd -r -u 999 -g appgroup -d /app -s /sbin/nologin appuser
|
useradd -r -u 999 -g appgroup -d /app -s /sbin/nologin appuser
|
||||||
@@ -115,5 +109,5 @@ EXPOSE 8001
|
|||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" || exit 1
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" || exit 1
|
||||||
|
|
||||||
# # Run the CV inference server
|
# Run the CV inference server
|
||||||
CMD ["python", "-m", "backend.cv_inference_server"]
|
CMD ["python", "-m", "backend.cv_inference_server"]
|
||||||
Reference in New Issue
Block a user