update
Some checks failed
Backend EC - Modal Deployment / build-and-push (push) Failing after 16m1s
Backend EC - Modal Deployment / notify-deploy (push) Has been skipped

This commit is contained in:
DatTT127
2026-07-19 02:44:14 +07:00
parent 538952f061
commit d8960ec448

View File

@@ -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"]