-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile.build
More file actions
58 lines (51 loc) · 1.82 KB
/
Dockerfile.build
File metadata and controls
58 lines (51 loc) · 1.82 KB
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
FROM golang:1.20-bookworm
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
file \
time \
; \
rm -rf /var/lib/apt/lists/*
# disable CGO for ALL THE THINGS (to help ensure no libc)
ENV CGO_ENABLED 0
ENV BUILD_FLAGS="-v -trimpath -ldflags '-d -w'"
RUN mkdir -pv /artifacts
WORKDIR /usr/src/gosleep
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# gosleep-$(dpkg --print-architecture | awk -F- '{ print $NF }')
RUN set -x \
&& eval "GOARCH=amd64 go build $BUILD_FLAGS -o /artifacts/gosleep-amd64" ./... \
&& file /artifacts/gosleep-amd64 \
&& /artifacts/gosleep-amd64 --help \
&& time /artifacts/gosleep-amd64 --for 1s
RUN set -x \
&& eval "GOARCH=386 go build $BUILD_FLAGS -o /artifacts/gosleep-i386" ./... \
&& file /artifacts/gosleep-i386 \
&& time /artifacts/gosleep-i386 --for 1s
RUN set -x \
&& eval "GOARCH=arm GOARM=5 go build $BUILD_FLAGS -o /artifacts/gosleep-armel" ./... \
&& file /artifacts/gosleep-armel
RUN set -x \
&& eval "GOARCH=arm GOARM=6 go build $BUILD_FLAGS -o /artifacts/gosleep-armhf" ./... \
&& file /artifacts/gosleep-armhf
# boo Raspberry Pi, making life hard
#RUN set -x \
# && eval "GOARCH=arm GOARM=7 go build $BUILD_FLAGS -o /artifacts/gosleep-armhf" ./... \
# && file /artifacts/gosleep-armhf
RUN set -x \
&& eval "GOARCH=arm64 go build $BUILD_FLAGS -o /artifacts/gosleep-arm64" ./... \
&& file /artifacts/gosleep-arm64
RUN set -x \
&& eval "GOARCH=ppc64 go build $BUILD_FLAGS -o /artifacts/gosleep-ppc64" ./... \
&& file /artifacts/gosleep-ppc64
RUN set -x \
&& eval "GOARCH=ppc64le go build $BUILD_FLAGS -o /artifacts/gosleep-ppc64el" ./... \
&& file /artifacts/gosleep-ppc64el
RUN set -x \
&& eval "GOARCH=s390x go build $BUILD_FLAGS -o /artifacts/gosleep-s390x" ./... \
&& file /artifacts/gosleep-s390x
RUN set -ex; \
ls -lAFh /artifacts; \
file /artifacts/*