wallarm/api-firewall

Published 386 musl binary appears to be amd64

tianon opened this issue ยท 1 comments

Hi! Building https://github.com/wallarm/api-firewall-docker/blob/5cd07f115f16d10095a385a73568a4e60caf278b/0.6.7/Dockerfile on i386 (docker build --platform linux/386) fails with /bin/sh: api-firewall: not found.

When downloading https://github.com/wallarm/api-firewall/releases/download/v0.6.7/api-firewall-386-musl.tar.gz in an amd64 container instead, I can successfully ldd (and run!) the binary:

$ docker run -it --rm alpine:3.15
/ # wget https://github.com/wallarm/api-firewall/releases/download/v0.6.7/api-firewall-386-musl.tar.gz
Connecting to github.com (192.30.255.113:443)
Connecting to objects.githubusercontent.com (185.199.111.133:443)
saving to 'api-firewall-386-musl.tar.gz'
api-firewall-386-mus 100% |********************************| 3589k  0:00:00 ETA
'api-firewall-386-musl.tar.gz' saved
/ # tar -xvf api-firewall-386-musl.tar.gz
./
./api-firewall
./LICENSE
/ # ldd api-firewall
	/lib/ld-musl-x86_64.so.1 (0x7f2461ac7000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f2461ac7000)
/ # ./api-firewall -v
Version: 0.6.7
Wallarm API-Firewall

I'm not 100% certain I'm looking in the right place, but it seems like

is maybe missing the same case block to set GOARCH=386 as build-x86: has?
case "${{ matrix.arch }}" in
"386")
export GOARCH=386
export GOHOSTARCH=amd64
export GOHOSTOS=linux
export GOOS=linux
;;
esac

Honestly, it should be pretty safe to just set GOARCH unilaterally -- if you're on amd64 and explicitly set GOARCH=amd64, it doesn't do anything (since that's the default detected value for that case). ๐Ÿ˜…

(Also, setting GOHOSTARCH and GOHOSTOS explicitly like that shouldn't be necessary.)

Thank you @tianon for your issue ๐Ÿ˜