Closed meeDamian closed 4 years ago
Yes. It's quite unfortunate how it's currently impossible to permute the value of ${ARCH}
using syntax avail in ENV
and ARG
only, to match all formats necessary :/.
I just remembered another reason why I used a script modifying Dockerfile
instead of using FROM ${ARCH}/alpine:3.11
notation… In the current setup the only thing possible to build w/o passing extra params is a native amd64
image.
Due to ARG ARCH=amd64
, even if you build the image on arm32v7
, if no params are passed the final stage will be just broken (arm32v7
binaries copied to amd64/alpine:3.11 AS final
stage).
I think that one can be fixed using default ARG
s, but I still need to look into it.
Ok, kill me 😊
What's wrong?
Ok, I actually found a solution to that! 🤯
FROM ${ARCH:+${ARCH}/}alpine:3.11 AS final
If ARCH is set, use it, but append /
to it.
If not, leave it empty.
Although I'm running build on arm
now, just to make sure…
I guess if all native builds work with a simple:
docker build .
And only cross-compilation requires passing sth extra ex:
docker build --build="ARCH=arm32v7" --build-arg="GOARCH=arm" --build-arg="GOARM=7" .
Then it's not that terrible 🤷🏻♂️. Sure, getting rid on the GO*
ones would be great, and can perhaps be done somehow later (ex. when FROM --platform=
works).
Although I'm running build on
arm
now, just to make sure…
And it didn't work… Gotta investigate, but now laptop is @ 🔋 6%, and no power plug in sight :( .
Ok, I think I'm finally quite happy with it ^^.
This change is