`sztabina` fails to build on Apple Silicon (arm64) (SZ-83)
rk@tigase.net opened 5 days ago

Defect: sztabina fails to build on Apple Silicon (arm64)

Release: 1.8
Severity: Blocker
Component: sztabina / Docker
Reported by: Wojciech Kapcia
Reproducible: Yes
Linked defect: Backend Flyway migration syntax error (Rel 1.8)


Environment

  • Host: macOS (MBP M1 / arm64)
  • Command:
cd deploy/docker
docker compose up --build

Observed Error

runtime: lfstack.push invalid packing

Occurs during Docker build step:

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o sztabina .

Root Cause

The sztabina Dockerfile hardcodes GOARCH=amd64, forcing cross-compilation on an arm64 host.
This triggers a Go runtime failure when building pure-Go binaries on Apple Silicon.


Expected Behavior

sztabina should build successfully on both:

  • linux/amd64
  • linux/arm64

without requiring manual architecture overrides.


Proposed Fix

Use Docker BuildKit architecture variables instead of hardcoding the target architecture:

ARG TARGETOS
ARG TARGETARCH

RUN CGO_ENABLED=0 \
    GOOS=${TARGETOS} \
    GOARCH=${TARGETARCH} \
    go build -o sztabina .

This allows Docker to select the correct architecture automatically.


Impact

  • docker compose up --build fails on Apple Silicon
  • Blocks local development on modern Macs
  • Prevents evaluation of Rel 1.8 on arm64 hosts

Notes

  • Deterministic and reproducible
  • No behavior change expected for x86 users
  • Fix aligns with Docker BuildKit best practices
  • rk@tigase.net changed fields 5 days ago
    Name Previous Value Current Value
    Priority
    Normal
    Blocker
  • rk@tigase.net commented 5 days ago

    rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout wolnosc

    Switched to branch 'wolnosc'
    Your branch is up to date with 'origin/wolnosc'.
    rksuma@Ramakrishnans-MacBook-Pro sztab % git pull origin wolnosc
    From https://tigase.dev/sztab
     * branch            wolnosc    -> FETCH_HEAD
    Already up to date.
    rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout -b fix/rel-1.8-docker-arm64-flyway
    Switched to a new branch 'fix/rel-1.8-docker-arm64-flyway'
    rksuma@Ramakrishnans-MacBook-Pro sztab % 
    
  • rk@tigase.net changed state to 'In Progress' 5 days ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 4 days ago

    Fixed in 1.8.1

  • rk@tigase.net changed state to 'Closed' 4 days ago
    Previous Value Current Value
    In Progress
    Closed
issue 1 of 1
Type
Bug
Priority
Blocker
Assignee
Version
1.8
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-83
Please wait...
Page is in error, reload to recover