From ee41c626f160e88f91de77c60d5ca9a2fadfe8d2 Mon Sep 17 00:00:00 2001 From: Tristan Autin Date: Mon, 29 Jun 2026 17:53:25 +0200 Subject: [PATCH] fix : portabilite Docker/Makefile sur macOS Apple Silicon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - env-init : test -f || cp (au lieu de cp --update=none, GNU-only, et cp -n qui renvoie exit 1 sur BSD quand la cible existe) — idempotent et POSIX - Dockerfile : telechargement de node selon l'architecture detectee (x64 sur amd64, arm64 sur Apple Silicon) --- infra/dev/Dockerfile | 19 +++++++++++++------ makefile | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/infra/dev/Dockerfile b/infra/dev/Dockerfile index 71b6c59..c5e8dd7 100644 --- a/infra/dev/Dockerfile +++ b/infra/dev/Dockerfile @@ -52,12 +52,19 @@ RUN apt-get update && apt-get install -y \ xsl -# Installation de node -RUN wget -qO- "https://nodejs.org/dist/v${DOCKER_NODE_VERSION}/node-v${DOCKER_NODE_VERSION}-linux-x64.tar.xz" | tar xJC /tmp/ && \ - cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-x64/bin /usr/ && \ - cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-x64/include /usr/ && \ - cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-x64/lib /usr/ && \ - cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-x64/share /usr/ && \ +# Installation de node — architecture detectee a la volee +# (x64 sur Intel/amd64, arm64 sur Apple Silicon) pour que le build passe sur les deux. +RUN NODE_ARCH="$(dpkg --print-architecture)" && \ + case "$NODE_ARCH" in \ + amd64) NODE_ARCH="x64" ;; \ + arm64) NODE_ARCH="arm64" ;; \ + *) echo "Architecture Node non supportee : $NODE_ARCH" && exit 1 ;; \ + esac && \ + wget -qO- "https://nodejs.org/dist/v${DOCKER_NODE_VERSION}/node-v${DOCKER_NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" | tar xJC /tmp/ && \ + cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-${NODE_ARCH}/bin /usr/ && \ + cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-${NODE_ARCH}/include /usr/ && \ + cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-${NODE_ARCH}/lib /usr/ && \ + cp -r /tmp/node-v${DOCKER_NODE_VERSION}-linux-${NODE_ARCH}/share /usr/ && \ npm install --global yarn # installation/activation d'extensions php diff --git a/makefile b/makefile index 67d070e..f274e0d 100644 --- a/makefile +++ b/makefile @@ -74,7 +74,7 @@ help: @printf "\n Plus de details : \033[4mREADME.md\033[0m, \033[4mCLAUDE.md\033[0m\n\n" env-init: - @cp --update=none $(ENV_DEFAULT) $(ENV_LOCAL) + @test -f $(ENV_LOCAL) || cp $(ENV_DEFAULT) $(ENV_LOCAL) # Lance le container start: env-init