env/linux-arm64-bookworm: add image

This is an attempt to upgrade the Debian image for linux-arm64.

For golang/go#69763.

Change-Id: I73e579bcd5599e4eb4461d81cd79ed45d8239dad
Reviewed-on: https://go-review.googlesource.com/c/build/+/622039
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2024-10-24 19:29:52 +00:00 коммит произвёл Gopher Robot
Родитель 798078114f
Коммит 18327fd9db
2 изменённых файлов: 118 добавлений и 0 удалений

91
env/linux-arm64-bookworm/Dockerfile поставляемый Normal file
Просмотреть файл

@ -0,0 +1,91 @@
# Copyright 2024 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
FROM arm64v8/golang:1.22 AS build
LABEL maintainer="golang-dev@googlegroups.com"
RUN mkdir /gocache
ENV GOCACHE=/gocache
COPY ./go.mod /go/src/golang.org/x/build/go.mod
COPY ./go.sum /go/src/golang.org/x/build/go.sum
WORKDIR /go/src/golang.org/x/build
# Optimization for iterative docker build speed, not necessary for correctness:
# TODO: write a tool to make writing Go module-friendly Dockerfiles easier.
RUN go install cloud.google.com/go/compute/metadata
COPY . /go/src/golang.org/x/build/
# Install binary to /go/bin/stage0
ENV CGO_ENABLED=0
RUN go install golang.org/x/build/cmd/buildlet/stage0
RUN go install golang.org/x/build/cmd/bootstrapswarm
FROM arm64v8/debian:bookworm
LABEL org.opencontainers.image.authors="golang-dev@googlegroups.com"
ENV DEBIAN_FRONTEND=noninteractive
# bzr: Bazaar VCS supported by cmd/go
# fonts-droid-fallback: required by x/mobile repo
# fossil: Fossil VCS supported by cmd/go
# gcc: for building Go's bootstrap 'dist' prog
# gdb: optionally used by runtime tests for gdb
# gfortran: for compiling cgo with fortran support (multilib for 386)
# git: git VCS supported by cmd/go
# g++: used for swig tests and building some benchmarks
# libc6-dev: for building Go's bootstrap 'dist' prog
# libgles2-mesa-dev: required by x/mobile repo
# libopenal-dev: required by x/mobile repo
# less: misc basic tool
# linux-perf: for performance analysis on perf builders
# lsof: misc basic tool
# make: used for setting up benchmarks in the x/benchmark builders
# mercurial: mercurial VCS supported by cmd/go
# netbase: for net package tests, issue 42750
# patch: used for building some benchmarks
# procps: misc basic tool
# psmisc: misc basic tool
# strace: optionally used by some net/http tests
# subversion: subversion VCS supported by cmd/go
# swig: used for c/c++ interop related tests
RUN apt-get update && apt-get install -y \
--no-install-recommends \
bzr \
ca-certificates \
curl \
fonts-droid-fallback \
fossil \
gcc \
gdb \
gfortran \
git \
g++ \
iptables \
iproute2 \
libc6-dev \
libgles2-mesa-dev \
libopenal-dev \
less \
linux-perf \
lsof \
make \
mercurial \
netbase \
openssh-server \
patch \
procps \
psmisc \
strace \
subversion \
sudo \
swig \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /go/bin/* /usr/local/bin/
COPY cmd/buildlet/stage0/run-worker.sh /usr/local/bin/
CMD ["/usr/local/bin/run-worker.sh"]

27
env/linux-arm64-bookworm/Makefile поставляемый Normal file
Просмотреть файл

@ -0,0 +1,27 @@
# Copyright 2023 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
IMAGE_NAME=$(shell basename $(CURDIR))
usage:
echo "see Makefile for usage for building $(IMAGE_NAME)"
docker: Dockerfile
# If this command is failing, run:
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# docker buildx create --name mybuilder
docker buildx build -t golang/$(IMAGE_NAME) --platform linux/arm64 --load -f Dockerfile ../..
testssh: docker
go install golang.org/x/build/cmd/buildlet/testssh
testssh --start-image=golang/$(IMAGE_NAME)
push-staging: docker
go install golang.org/x/build/cmd/xb
xb --staging docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
xb --staging docker push REPO/$(IMAGE_NAME):latest
push-prod: docker
xb --prod docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
xb --prod docker push REPO/$(IMAGE_NAME):latest