mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 21:59:34 +00:00
Force asset build stages to run on native platform with --platform=$BUILDPLATFORM
Added --platform=$BUILDPLATFORM to composer-deps and assets stages to ensure they run on the native build platform (amd64) instead of being built separately for each target architecture (amd64, arm64, arm/v7). This is the critical change that makes the optimization work: - Without this flag, Docker Buildx builds these stages for each target platform - With this flag, stages run once on native platform and results are copied to all targets - Eliminates ARM emulation overhead for CPU-intensive asset compilation Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
This commit is contained in:
parent
6a1792d46a
commit
c5210a33c4
2 changed files with 8 additions and 4 deletions
|
|
@ -4,7 +4,9 @@ ARG PHP_VERSION=8.4
|
|||
# ---
|
||||
# Build assets stage - runs on native platform (not emulated)
|
||||
# This stage builds the frontend assets (JavaScript, CSS) using Node.js and Yarn
|
||||
FROM composer:latest AS composer-deps
|
||||
# The --platform=$BUILDPLATFORM ensures this stage runs on the native build platform (amd64)
|
||||
# and not under emulation for ARM builds
|
||||
FROM --platform=$BUILDPLATFORM composer:latest AS composer-deps
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
|
|
@ -19,7 +21,7 @@ RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignor
|
|||
|
||||
# ---
|
||||
|
||||
FROM node:22-bookworm-slim AS assets
|
||||
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS assets
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
# ---
|
||||
# Build assets stage - runs on native platform (not emulated)
|
||||
# This stage builds the frontend assets (JavaScript, CSS) using Node.js and Yarn
|
||||
FROM composer:latest AS composer-deps
|
||||
# The --platform=$BUILDPLATFORM ensures this stage runs on the native build platform (amd64)
|
||||
# and not under emulation for ARM builds
|
||||
FROM --platform=$BUILDPLATFORM composer:latest AS composer-deps
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
|
|
@ -16,7 +18,7 @@ RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist --ignor
|
|||
|
||||
# ---
|
||||
|
||||
FROM node:22-bookworm-slim AS assets
|
||||
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS assets
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue