forked from tianon/gosu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (50 loc) · 1.79 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM golang:1.16-alpine3.14
RUN apk add --no-cache file
# disable CGO for ALL THE THINGS (to help ensure no libc)
ENV CGO_ENABLED 0
WORKDIR /go/src/github.com/tianon/gosu
COPY go.mod go.sum ./
RUN set -eux; \
go mod download; \
go mod verify
ENV BUILD_FLAGS="-v -ldflags '-d -s -w'"
COPY *.go ./
# gosu-$(dpkg --print-architecture)
RUN set -eux; \
eval "GOARCH=amd64 go build $BUILD_FLAGS -o /go/bin/gosu-amd64"; \
file /go/bin/gosu-amd64; \
/go/bin/gosu-amd64 --version; \
/go/bin/gosu-amd64 nobody id; \
/go/bin/gosu-amd64 nobody ls -l /proc/self/fd
RUN set -eux; \
eval "GOARCH=386 go build $BUILD_FLAGS -o /go/bin/gosu-i386"; \
file /go/bin/gosu-i386; \
/go/bin/gosu-i386 --version; \
/go/bin/gosu-i386 nobody id; \
/go/bin/gosu-i386 nobody ls -l /proc/self/fd
RUN set -eux; \
eval "GOARCH=arm GOARM=5 go build $BUILD_FLAGS -o /go/bin/gosu-armel"; \
file /go/bin/gosu-armel
RUN set -eux; \
eval "GOARCH=arm GOARM=6 go build $BUILD_FLAGS -o /go/bin/gosu-armhf"; \
file /go/bin/gosu-armhf
# boo Raspberry Pi, making life hard (armhf-is-v7 vs armhf-is-v6 ...)
#RUN set -eux; \
# eval "GOARCH=arm GOARM=7 go build $BUILD_FLAGS -o /go/bin/gosu-armhf"; \
# file /go/bin/gosu-armhf
RUN set -eux; \
eval "GOARCH=arm64 go build $BUILD_FLAGS -o /go/bin/gosu-arm64"; \
file /go/bin/gosu-arm64
RUN set -eux; \
eval "GOARCH=mips64le go build $BUILD_FLAGS -o /go/bin/gosu-mips64el"; \
file /go/bin/gosu-mips64el
RUN set -eux; \
eval "GOARCH=ppc64le go build $BUILD_FLAGS -o /go/bin/gosu-ppc64el"; \
file /go/bin/gosu-ppc64el
RUN set -eux; \
eval "GOARCH=riscv64 go build $BUILD_FLAGS -o /go/bin/gosu-riscv64"; \
file /go/bin/gosu-riscv64
RUN set -eux; \
eval "GOARCH=s390x go build $BUILD_FLAGS -o /go/bin/gosu-s390x"; \
file /go/bin/gosu-s390x
RUN set -eux; ls -lAFh /go/bin/gosu-*; file /go/bin/gosu-*