|
1 | 1 | # Explicitly using an docker.io/amd64/ image to avoid binary translation (assuming the build host is amd64) |
2 | | -# golang:1.20 is based on debian:12, this is important to ensure we have libc compatibility for the copied binary |
3 | | -FROM --platform=linux/amd64 docker.io/amd64/golang:1.20 as builder-amd64 |
| 2 | +# |
| 3 | +# golang:1.21-bookworm is based on debian:bookworm, this is important to ensure we have libc compatibility for the copied binary |
| 4 | + |
| 5 | +FROM --platform=linux/amd64 docker.io/amd64/golang:1.21-bookworm as builder-amd64 |
4 | 6 | # We use dynamic linking when possible to reduce compile time and binary size |
5 | 7 | ENV CGO_ENABLED=1 |
6 | 8 | COPY . /usr/src/mantle |
7 | 9 | # Build both here because variable builder names (to avoid caching and reusing the wrong one) are only supported with buildkit |
8 | 10 | RUN bash -c 'cd /usr/src/mantle && ./build ; mv bin bin-amd64 ; CGO_ENABLED=0 GOARCH=arm64 ./build ; mv bin bin-arm64' |
9 | 11 |
|
10 | | -# See comment above about golang:1.20 why debian:12 is set here |
11 | | -FROM docker.io/library/debian:12 |
12 | | -RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y qemu-utils qemu-system-x86 qemu-system-aarch64 qemu-efi-aarch64 seabios ovmf lbzip2 sudo dnsmasq gnupg2 git curl iptables nftables dns-root-data ca-certificates sqlite3 jq awscli azure-cli |
| 12 | +# See comment above about golang:1.21-bookworm why debian:bookworm is set here |
| 13 | +FROM docker.io/library/debian:bookworm |
| 14 | +RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y awscli azure-cli ca-certificates curl dns-root-data dnsmasq git gnupg2 iptables jq lbzip2 nftables ovmf python-is-python3 python3 qemu-efi-aarch64 qemu-system-aarch64 qemu-system-x86 qemu-utils seabios sqlite3 sudo |
13 | 15 | # from https://cloud.google.com/storage/docs/gsutil_install#deb |
14 | | -RUN echo "deb http://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list && curl -fsSLo /etc/apt/trusted.gpg.d/cloud.google.gpg https://dl.k8s.io/apt/doc/apt-key.gpg && apt-get update -y && apt-get install --no-install-recommends -y python3 && apt-get install -y google-cloud-cli |
| 16 | +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.asc] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | tee /usr/share/keyrings/cloud.google.asc && apt-get update -y && apt-get install google-cloud-sdk -y |
15 | 17 | COPY --from=builder-amd64 /usr/src/mantle/bin-amd64 /usr/local/bin-amd64 |
16 | 18 | COPY --from=builder-amd64 /usr/src/mantle/bin-arm64 /usr/local/bin-arm64 |
17 | 19 | RUN bash -c 'if [ "$(uname -m)" == "x86_64" ]; then rm -rf /usr/local/bin /usr/local/bin-arm64 ; mv /usr/local/bin-amd64 /usr/local/bin ; else rm -rf /usr/local/bin /usr/local/bin-amd64 ; mv /usr/local/bin-arm64 /usr/local/bin ; fi' |
|
0 commit comments