-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile.cross
48 lines (40 loc) · 1.46 KB
/
Dockerfile.cross
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
FROM golang:1.21-alpine3.19
# trust, but verify
RUN [ -z "$(ls -A1 /go/bin || :)" ]
# disable CGO for ALL THE THINGS (to help ensure no libc)
ENV CGO_ENABLED 0
ENV GOFLAGS="-v -a -trimpath"
# https://golang.org/issue/26849
ENV BUILD_FLAGS="-ldflags '-d -w' ./cmd/rawdns"
# intentionally *not* including "-s" so that we can run "govulncheck" on the result (minor size increase)
WORKDIR /usr/local/src/rawdns
COPY go.mod go.sum ./
RUN set -eux; \
go mod download; \
go mod verify
COPY . .
# rawdns-$(dpkg --print-architecture)
RUN set -eux; \
eval "GOARCH=386 go build -o /go/bin/rawdns-i386 $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=amd64 go build -o /go/bin/rawdns-amd64 $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=arm GOARM=5 go build -o /go/bin/rawdns-armel $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=arm GOARM=6 go build -o /go/bin/rawdns-armhf $BUILD_FLAGS"
# boo Raspberry Pi, making life hard
#RUN set -eux; \
# eval "GOARCH=arm GOARM=7 go build -o /go/bin/rawdns-armhf $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=arm64 go build -o /go/bin/rawdns-arm64 $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=mips64le go build -o /go/bin/rawdns-mips64el $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=ppc64le go build -o /go/bin/rawdns-ppc64el $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=riscv64 go build -o /go/bin/rawdns-riscv64 $BUILD_FLAGS"
RUN set -eux; \
eval "GOARCH=s390x go build -o /go/bin/rawdns-s390x $BUILD_FLAGS"
RUN set -eux; \
apk add --no-cache file; \
file /go/bin/rawdns-*