Skip to content

Commit e7051bf

Browse files
heschigopherbot
authored andcommitted
env/linux-arm64-bullseye: update for LUCI, use buildkit
Copy the relevant chunks of the stage0 Dockerfile into here, and fork the Makefile to use buildkit to build for ARM64 rather than requiring an ARM64 machine to do the build. I am not a Docker expert, so I don't know if there's a better way to do this. Sorry future maintainers. Change-Id: I812b4e420f5f0a506ac05cf08a10869f4a22701e Reviewed-on: https://go-review.googlesource.com/c/build/+/509455 Auto-Submit: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent a5bca46 commit e7051bf

File tree

2 files changed

+54
-8
lines changed

2 files changed

+54
-8
lines changed

env/linux-arm64-bullseye/Dockerfile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5+
FROM arm64v8/golang:1.19 AS build
6+
LABEL maintainer="[email protected]"
7+
8+
RUN mkdir /gocache
9+
ENV GOCACHE /gocache
10+
11+
COPY ./go.mod /go/src/golang.org/x/build/go.mod
12+
COPY ./go.sum /go/src/golang.org/x/build/go.sum
13+
14+
WORKDIR /go/src/golang.org/x/build
15+
16+
# Optimization for iterative docker build speed, not necessary for correctness:
17+
# TODO: write a tool to make writing Go module-friendly Dockerfiles easier.
18+
RUN go install cloud.google.com/go/compute/metadata
19+
20+
COPY . /go/src/golang.org/x/build/
21+
22+
# Install binary to /go/bin/stage0
23+
ENV CGO_ENABLED=0
24+
RUN go install golang.org/x/build/cmd/buildlet/stage0
25+
RUN go install golang.org/x/build/cmd/bootstrapswarm
26+
527
FROM arm64v8/debian:bullseye
628
LABEL org.opencontainers.image.authors="[email protected]"
729

@@ -38,6 +60,7 @@ RUN apt-get update && apt-get install -y \
3860
gfortran \
3961
git \
4062
iptables \
63+
iproute2 \
4164
libc6-dev \
4265
libgles2-mesa-dev \
4366
libopenal-dev \
@@ -50,14 +73,11 @@ RUN apt-get update && apt-get install -y \
5073
psmisc \
5174
strace \
5275
subversion \
76+
sudo \
5377
swig \
5478
&& rm -rf /var/lib/apt/lists/*
5579

56-
RUN mkdir /usr/local/go-bootstrap && \
57-
curl --silent https://storage.googleapis.com/go-builder-data/gobootstrap-linux-arm64.tar.gz | \
58-
tar -C /usr/local/go-bootstrap -zx
59-
60-
RUN curl -o /usr/local/bin/stage0 https://storage.googleapis.com/go-builder-data/buildlet-stage0.linux-arm64 && \
61-
chmod +x /usr/local/bin/stage0
80+
COPY --from=build /go/bin/* /usr/local/bin/
81+
COPY cmd/buildlet/stage0/run-worker.sh /usr/local/bin/
6282

63-
CMD ["/usr/local/bin/stage0"]
83+
CMD ["/usr/local/bin/run-worker.sh"]

env/linux-arm64-bullseye/Makefile

Lines changed: 0 additions & 1 deletion
This file was deleted.

env/linux-arm64-bullseye/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2023 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
IMAGE_NAME=$(shell basename $(CURDIR))
6+
7+
usage:
8+
echo "see Makefile for usage for building $(IMAGE_NAME)"
9+
10+
docker: Dockerfile
11+
# If this command is failing, run:
12+
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
13+
# docker buildx create --name mybuilder
14+
docker buildx build -t golang/$(IMAGE_NAME) --platform linux/arm64 --load -f Dockerfile ../..
15+
16+
testssh: docker
17+
go install golang.org/x/build/cmd/buildlet/testssh
18+
testssh --start-image=golang/$(IMAGE_NAME)
19+
20+
push-staging: docker
21+
go install golang.org/x/build/cmd/xb
22+
xb --staging docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
23+
xb --staging docker push REPO/$(IMAGE_NAME):latest
24+
25+
push-prod: docker
26+
xb --prod docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
27+
xb --prod docker push REPO/$(IMAGE_NAME):latest

0 commit comments

Comments
 (0)