Skip to content

Commit

Permalink
fix(SLB-207): install composer dependencies in builder
Browse files Browse the repository at this point in the history
To make sure all package prep scripts have access to
contents of composer dependencies.
  • Loading branch information
pmelab committed Dec 11, 2023
1 parent 0afb9bb commit abf48c9
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .lagoon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ====================================================================================================
# BUILDER IMAGE
# ====================================================================================================
FROM uselagoon/node-18-builder as builder
FROM uselagoon/php-8.2-cli-drupal as builder

ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1

Expand All @@ -17,6 +17,21 @@ RUN --mount=type=cache,target=/tmp/cache pnpm fetch && \
# So we remove them now.
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

# Install composer dependencies.
# They may contain directive definitions required by prep scripts.
WORKDIR /app/apps/cms
RUN apk add --no-cache git qpdf imagemagick icu-dev && \
docker-php-ext-install intl && \
docker-php-ext-enable intl
RUN composer config --global github-protocols https
COPY apps/cms/composer.* /app/apps/cms/
COPY apps/cms/patches /app/apps/cms/patches
COPY apps/cms/scaffold /app/apps/cms/scaffold
ENV COMPOSER_HOME=/tmp/cache/composer
RUN --mount=type=cache,target=/tmp/cache composer install --no-dev

WORKDIR /app

# Copy the all package sources, install and prepare them.
COPY . /app
RUN --mount=type=cache,target=/tmp/cache pnpm i && \
Expand All @@ -36,14 +51,6 @@ FROM uselagoon/php-8.2-cli-drupal as cli
RUN apk add --no-cache git qpdf imagemagick icu-dev && \
docker-php-ext-install intl && \
docker-php-ext-enable intl
RUN composer config --global github-protocols https

COPY --from=builder /tmp/.deploy/cms/composer.json /app/composer.json
COPY --from=builder /tmp/.deploy/cms/composer.lock /app/composer.lock
COPY --from=builder /tmp/.deploy/cms/scaffold /app/scaffold
COPY --from=builder /tmp/.deploy/cms/patches /app/patches
ENV COMPOSER_HOME=/tmp/cache/composer
RUN --mount=type=cache,target=/tmp/cache composer install --no-dev

COPY --from=builder /tmp/.deploy/cms /app

Expand Down

0 comments on commit abf48c9

Please sign in to comment.