From 3c5678f8a86955e92e5d8414c96cbf56c65dcfc2 Mon Sep 17 00:00:00 2001 From: ahmza Date: Mon, 3 Aug 2026 15:40:22 +0000 Subject: [PATCH] Run Hugo natively in build stage to skip QEMU emulation Pin the build stage to $BUILDPLATFORM so Hugo runs once on the native arch instead of once per target arch under QEMU. Hugo output is static HTML and identical across arches, so the emulated arm64 Hugo run (~59s vs ~12s native) plus emulated base-image extraction were pure waste. The runtime stage stays on TARGETPLATFORM, so multi-arch amd64+arm64 images are still produced. --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 62c0cea..250d082 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,9 @@ -FROM ghcr.io/hugomods/hugo:0.157.0 AS build +# syntax=docker/dockerfile:1 +# Pin the build stage to the native build platform so Hugo runs once (never +# under QEMU emulation). Hugo output is static HTML — identical across arches — +# so there's no reason to run it per target arch. The runtime stage below stays +# on TARGETPLATFORM, so multi-arch (amd64 + arm64) runtime images are preserved. +FROM --platform=$BUILDPLATFORM ghcr.io/hugomods/hugo:0.157.0 AS build WORKDIR /tmp/hugo COPY . . RUN hugo --gc --minify