diff --git a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile index 2937b40..0add326 100644 --- a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile +++ b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile @@ -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.txt . -# Build wheel files for all dependencies AND their transitive dependencies. -# --wheel-dir=/wheels: write .whl files to the wheelhouse directory -# (no --no-deps: we want the full dependency tree pre-compiled) -# RUN python -m pip install --no-cache-dir --upgrade pip && \ -# 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 +# FIX: Create an isolated venv to compile wheels so Kaniko doesn't corrupt global pip vendor files +RUN python -m venv /opt/wheelhouse-env && \ + /opt/wheelhouse-env/bin/pip install --no-cache-dir --upgrade pip && \ + /opt/wheelhouse-env/bin/pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements.txt + # ============================================================================= # Stage 2: Application Builder # Creates a venv and installs dependencies from the local wheelhouse. @@ -79,11 +78,6 @@ FROM python:3.12-slim-bookworm AS runtime 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 RUN groupadd -g 999 appgroup && \ 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 \ 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"] \ No newline at end of file