From 79655d9d304eca7f43b23a4814e8cca4a254334d Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 30 Jul 2024 12:46:27 +0100 Subject: Only install LDAP group in wheel build stage This is the only group that requires gcc --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b3f20c..2fced88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,20 @@ FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:$python_version RUN apt-get update && apt-get install --no-install-recommends -y libldap2-dev libsasl2-dev gcc && apt autoclean && rm -rf /var/lib/apt/lists/* COPY pyproject.toml poetry.lock ./ -RUN poetry install --without dev --no-root + +# Only the LDAP group has deps that requires gcc, so only build that for now +RUN poetry install --only ldap --no-root FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:$python_version RUN apt-get update && apt-get install --no-install-recommends -y libmagickwand-dev && rm -rf /var/lib/apt/lists/* -# Install project dependencies WORKDIR /app + +# Copy the pre-built LDAP group from the build stage that required gcc COPY --from=wheel-builder /opt/poetry/cache /opt/poetry/cache + +# Install the rest of the dependencies COPY pyproject.toml poetry.lock ./ RUN poetry install --without dev --with ldap --no-root -- cgit v1.2.3