From d6215a055e393ceb44a3cf83062849fb4cd8a41c Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Mon, 2 Aug 2021 18:26:17 -0400 Subject: [PATCH] Change Dockerfile for cross building - Download and build vendor dependencies once on native platform - Build final image N times for N platforms with Docker emulation --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d9c1aad8..e790113f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ +ARG BUILDPLATFORM=linux/amd64 +ARG TARGETPLATFORM ARG DEBIAN_VERSION=buster-slim ARG COMPOSER_VERSION=2.1 ARG SUPERVISORD_VERSION=v0.7.3 +FROM --platform=${BUILDPLATFORM} composer:${COMPOSER_VERSION} AS build-composer FROM composer:${COMPOSER_VERSION} AS composer FROM qmcgaw/binpot:supervisord-${SUPERVISORD_VERSION} AS supervisord -FROM debian:${DEBIAN_VERSION} AS vendor +FROM --platform=${BUILDPLATFORM} debian:${DEBIAN_VERSION} AS vendor ENV DEBIAN_FRONTEND=noninteractive -COPY --from=composer --chown=www-data /usr/bin/composer /usr/bin/composer +COPY --from=build-composer --chown=www-data /usr/bin/composer /usr/bin/composer RUN apt-get update && \ apt-get install -y --no-install-recommends \ # PHP