You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# note: we cannot add "-s" here because then "govulncheck" does not work (see SECURITY.md); the ~0.2MiB increase (as of 2022-12-16, Go 1.18) is worth it
# there's a fun QEMU + Go 1.18+ bug that causes our binaries (especially on ARM arches) to hang indefinitely *sometimes*, hence the "timeout" and looping here
22
+
echo ' try() { for (( i = 0; i < 30; i++ )); do if timeout 1s "$@"; then return 0; fi; done; return 1; }'; \
23
+
echo ' try "/go/bin/gosu-$ARCH" --version'; \
24
+
echo ' try "/go/bin/gosu-$ARCH" nobody id'; \
25
+
echo ' try "/go/bin/gosu-$ARCH" nobody ls -l /proc/self/fd'; \
26
+
echo 'fi'; \
27
+
} > /usr/local/bin/gosu-build-and-test.sh; \
28
+
chmod +x /usr/local/bin/gosu-build-and-test.sh
4
29
5
30
# disable CGO for ALL THE THINGS (to help ensure no libc)
6
31
ENV CGO_ENABLED 0
@@ -12,57 +37,18 @@ RUN set -eux; \
12
37
go mod download; \
13
38
go mod verify
14
39
15
-
# note: we cannot add "-s" here because then "govulncheck" does not work (see SECURITY.md); the ~0.2MiB increase (as of 2022-12-16, Go 1.18) is worth it
16
-
ENV BUILD_FLAGS="-v -ldflags '-d -w'"
17
-
18
40
COPY *.go ./
19
41
20
42
# gosu-$(dpkg --print-architecture)
21
-
RUN set -eux; \
22
-
eval "GOARCH=amd64 go build $BUILD_FLAGS -o /go/bin/gosu-amd64"; \
23
-
file /go/bin/gosu-amd64; \
24
-
/go/bin/gosu-amd64 --version; \
25
-
/go/bin/gosu-amd64 nobody id; \
26
-
/go/bin/gosu-amd64 nobody ls -l /proc/self/fd
27
-
28
-
RUN set -eux; \
29
-
eval "GOARCH=386 go build $BUILD_FLAGS -o /go/bin/gosu-i386"; \
30
-
file /go/bin/gosu-i386; \
31
-
/go/bin/gosu-i386 --version; \
32
-
/go/bin/gosu-i386 nobody id; \
33
-
/go/bin/gosu-i386 nobody ls -l /proc/self/fd
34
-
35
-
RUN set -eux; \
36
-
eval "GOARCH=arm GOARM=5 go build $BUILD_FLAGS -o /go/bin/gosu-armel"; \
37
-
file /go/bin/gosu-armel
38
-
39
-
RUN set -eux; \
40
-
eval "GOARCH=arm GOARM=6 go build $BUILD_FLAGS -o /go/bin/gosu-armhf"; \
41
-
file /go/bin/gosu-armhf
42
-
43
-
# boo Raspberry Pi, making life hard (armhf-is-v7 vs armhf-is-v6 ...)
44
-
#RUN set -eux; \
45
-
# eval "GOARCH=arm GOARM=7 go build $BUILD_FLAGS -o /go/bin/gosu-armhf"; \
46
-
# file /go/bin/gosu-armhf
47
-
48
-
RUN set -eux; \
49
-
eval "GOARCH=arm64 go build $BUILD_FLAGS -o /go/bin/gosu-arm64"; \
50
-
file /go/bin/gosu-arm64
51
-
52
-
RUN set -eux; \
53
-
eval "GOARCH=mips64le go build $BUILD_FLAGS -o /go/bin/gosu-mips64el"; \
54
-
file /go/bin/gosu-mips64el
55
-
56
-
RUN set -eux; \
57
-
eval "GOARCH=ppc64le go build $BUILD_FLAGS -o /go/bin/gosu-ppc64el"; \
58
-
file /go/bin/gosu-ppc64el
59
-
60
-
RUN set -eux; \
61
-
eval "GOARCH=riscv64 go build $BUILD_FLAGS -o /go/bin/gosu-riscv64"; \
62
-
file /go/bin/gosu-riscv64
63
-
64
-
RUN set -eux; \
65
-
eval "GOARCH=s390x go build $BUILD_FLAGS -o /go/bin/gosu-s390x"; \
66
-
file /go/bin/gosu-s390x
43
+
RUN ARCH=amd64 GOARCH=amd64 gosu-build-and-test.sh
44
+
RUN ARCH=i386 GOARCH=386 gosu-build-and-test.sh
45
+
RUN ARCH=armel GOARCH=arm GOARM=5 gosu-build-and-test.sh
46
+
RUN ARCH=armhf GOARCH=arm GOARM=6 gosu-build-and-test.sh
47
+
#RUN ARCH=armhf GOARCH=arm GOARM=7 gosu-build-and-test.sh # boo Raspberry Pi, making life hard (armhf-is-v7 vs armhf-is-v6 ...)
48
+
RUN ARCH=arm64 GOARCH=arm64 gosu-build-and-test.sh
49
+
RUN ARCH=mips64el GOARCH=mips64le gosu-build-and-test.sh
50
+
RUN ARCH=ppc64el GOARCH=ppc64le gosu-build-and-test.sh
51
+
RUN ARCH=riscv64 GOARCH=riscv64 gosu-build-and-test.sh
52
+
RUN ARCH=s390x GOARCH=s390x gosu-build-and-test.sh
67
53
68
54
RUN set -eux; ls -lAFh /go/bin/gosu-*; file /go/bin/gosu-*
0 commit comments