Skip to content

Instantly share code, notes, and snippets.

@wader
Created June 26, 2021 07:04
Show Gist options
  • Save wader/3467ec5a342a704cd61867054b92e9ec to your computer and use it in GitHub Desktop.
Save wader/3467ec5a342a704cd61867054b92e9ec to your computer and use it in GitHub Desktop.
alpine arch in dockerfile
https://github.com/docker-library/golang/blob/f300e60ca19c3b98cfcf01ca112af2ac10104320/1.17-rc/alpine3.14/Dockerfile#L30
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
'x86_64') \
export GOARCH='amd64' GOOS='linux'; \
;; \
'armhf') \
export GOARCH='arm' GOARM='6' GOOS='linux'; \
;; \
'armv7') \
export GOARCH='arm' GOARM='7' GOOS='linux'; \
;; \
'aarch64') \
export GOARCH='arm64' GOOS='linux'; \
;; \
'x86') \
export GO386='softfloat' GOARCH='386' GOOS='linux'; \
;; \
'ppc64le') \
export GOARCH='ppc64le' GOOS='linux'; \
;; \
's390x') \
export GOARCH='s390x' GOOS='linux'; \
;; \
*) echo >&2 "error: unsupported architecture '$apkArch' (likely packaging update needed)"; exit 1 ;; \
esac; \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment