Skip to content

Commit ed04fe6

Browse files
authored
Merge pull request docker-library#3022 from infosiftr/bashbrew-arches
Refactor bashbrew release Dockerfile to use "bashbrew arches" in the released binary names
2 parents 347b218 + 76e1068 commit ed04fe6

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

bashbrew/Dockerfile.release

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,48 @@ COPY go .
1616
RUN set -ex; \
1717
mkdir bin; \
1818
for osArch in \
19-
darwin/amd64 \
20-
linux/amd64 \
21-
linux/arm64 \
22-
linux/ppc64le \
23-
linux/s390x \
24-
windows/amd64 \
19+
amd64 \
20+
arm32v5 \
21+
arm32v6 \
22+
arm32v7 \
23+
arm64v8 \
24+
darwin-amd64 \
25+
i386 \
26+
ppc64le \
27+
s390x \
28+
windows-amd64 \
2529
; do \
26-
os="${osArch%%/*}"; \
27-
arch="${osArch#$os/}"; \
28-
# TODO GOARM
30+
os="${osArch%%-*}"; \
31+
[ "$os" != "$osArch" ] || os='linux'; \
32+
export GOOS="$os"; \
33+
arch="${osArch#${os}-}"; \
34+
unset GOARM GO386; \
35+
case "$arch" in \
36+
arm32v*) export GOARCH='arm' GOARM="${arch#arm32v}" ;; \
37+
# no GOARM for arm64 (yet?) -- https://github.com/golang/go/blob/1e72bf62183ea21b9affffd4450d44d994393899/src/cmd/internal/objabi/util.go#L40
38+
arm64v*) export GOARCH='arm64' ;; \
39+
i386) export GOARCH='386' ;; \
40+
*) export GOARCH="$arch" ;; \
41+
esac; \
2942
\
3043
[ "$os" = 'windows' ] && ext='.exe' || ext=''; \
3144
\
32-
GOOS="$os" GOARCH="$arch" \
33-
go build \
34-
-a -v \
35-
-ldflags '-s -w' \
36-
-tags netgo -installsuffix netgo \
37-
-o "bin/bashbrew-$os-$arch$ext" \
38-
./src/bashbrew; \
45+
go build \
46+
-a -v \
47+
-ldflags '-s -w' \
48+
# see https://github.com/golang/go/issues/9737#issuecomment-276817652 (and following comments) -- installsuffix is necessary (for now) to keep ARM
49+
# can remove "$osArch" from "installsuffix" in Go 1.10+ (https://github.com/golang/go/commit/1b53f15ebb00dd158af674df410c7941abb2b933)
50+
-tags netgo -installsuffix "netgo-$osArch" \
51+
-o "bin/bashbrew-$osArch$ext" \
52+
./src/bashbrew; \
3953
\
54+
case "$GOARCH" in \
55+
# manifest-tool and GOARM aren't friends yet
56+
# ... and estesp is probably a big fat "lololol" on supporting i386 :D
57+
arm|386) continue ;; \
58+
esac; \
4059
# TODO verify GPG signatures for manifest-tool releases
41-
wget -O "bin/manifest-tool-$os-$arch$ext" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-$os-$arch$ext"; \
60+
wget -O "bin/manifest-tool-$osArch$ext" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-$GOOS-$GOARCH$ext"; \
4261
done; \
4362
ls -l bin; \
4463
file bin/*

0 commit comments

Comments
 (0)