From 6a7a42d4361d09b48234bde9ba83645ad2e6459f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 01:27:08 +0000 Subject: [PATCH 1/2] Refactor Dockerfile to use setuptools build The Docker build was failing in the CI/CD pipeline because it was attempting to use Poetry to export dependencies, but the project is configured to use setuptools. This commit refactors the Dockerfile to use a standard, multi-stage build process with setuptools. The builder stage now creates a Python wheel, which is then installed in the runtime stage. This resolves the build error and correctly installs the application and its dependencies. --- Dockerfile | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 697748f..a6c2860 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,18 @@ # Stage 1: Builder FROM python:3.12-slim AS builder -# Install poetry -RUN pip install --no-cache-dir poetry==1.8.2 +# Install build dependencies +RUN pip install --no-cache-dir build # Set the working directory WORKDIR /app -# Copy the project files and install dependencies -COPY pyproject.toml poetry.lock* ./ +# Copy the project files +COPY pyproject.toml . COPY src/ ./src/ -# Export dependencies and install them -RUN mkdir -p /install && \ - poetry export -f requirements.txt --output requirements.txt --without-hashes && \ - pip install --no-cache-dir --prefix="/install" -r requirements.txt +# Build the wheel +RUN python -m build --wheel --outdir /wheels # Stage 2: Runtime @@ -30,11 +28,8 @@ ENV PATH="/home/appuser/.local/bin:${PATH}" # Set the working directory WORKDIR /home/appuser/app -# Copy the installed dependencies from the builder stage -COPY --from=builder /install /usr/local +# Copy the wheel from the builder stage +COPY --from=builder /wheels /wheels -# Copy the application source code from the builder stage -COPY --from=builder /app/src/my_python_project ./my_python_project - -# Set the PYTHONPATH to include the installed packages -ENV PYTHONPATH="/home/appuser/app" +# Install the application wheel +RUN pip install --no-cache-dir /wheels/*.whl From a7bcce7727723f7cb72e158ec5fcb48a2b50dabc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 26 Oct 2025 01:31:11 +0000 Subject: [PATCH 2/2] Refactor Dockerfile to use setuptools build The Docker build was failing in the CI/CD pipeline because it was attempting to use Poetry to export dependencies, but the project is configured to use setuptools. This commit refactors the Dockerfile to use a standard, multi-stage build process with setuptools. The builder stage now creates a Python wheel, which is then installed in the runtime stage. This resolves the build error and correctly installs the application and its dependencies. Additionally, the `build` package version has been pinned to `1.3.0` to satisfy the `hadolint` pre-commit hook. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a6c2860..06e7471 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.12-slim AS builder # Install build dependencies -RUN pip install --no-cache-dir build +RUN pip install --no-cache-dir build==1.3.0 # Set the working directory WORKDIR /app