mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-06-05 22:53:53 +00:00
fix: remove hardcoded platform args causing wrong architecture builds
CRITICAL FIX: arm64 images were getting amd64 binaries causing "exec format error" when running on ARM platforms. Root cause: - Dockerfiles had ARG TARGETOS=linux and ARG TARGETARCH=amd64 - FROM --platform=$TARGETOS/$TARGETARCH used these defaults - buildx couldn't override them, so all builds used amd64 Solution: - Removed --platform from FROM statement - Let buildx automatically handle platform selection - Declared ARGs AFTER FROM to receive buildx values - buildx automatically sets TARGETPLATFORM, TARGETOS, TARGETARCH Now each platform builds native binaries: - linux/amd64 → amd64 binary - linux/arm64 → arm64 binary This fixes: exec /usr/local/bin/migrate: exec format error
This commit is contained in:
+7
-3
@@ -1,10 +1,14 @@
|
||||
# Application Engine - GoHoarder Server
|
||||
# Multi-stage build to compile with CGO support
|
||||
ARG TARGETOS=linux
|
||||
ARG TARGETARCH=amd64
|
||||
|
||||
# Build stage
|
||||
FROM --platform=$TARGETOS/$TARGETARCH golang:1.25-alpine AS builder
|
||||
# Let buildx handle platform automatically
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
# Get build platform from buildx
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
# Install build dependencies for CGO
|
||||
RUN apk add --no-cache \
|
||||
|
||||
Reference in New Issue
Block a user