Skip to content

Commit 9041e23

Browse files
konstantin-s-bogomgvisor-bot
authored andcommitted
Allow default Docker image base to be configurable.
PiperOrigin-RevId: 807371902
1 parent 57697a8 commit 9041e23

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.buildkite/hooks/pre-command

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ clear_docker_containers
88
# deleted on an ongoing basis. Such partial deletion can break the cache state.
99
# Using per day cache will ensure that builds triggered on a certain day have
1010
# the full bazel remote cache to use. TTL of the cache must be >1 day.
11-
export BAZEL_REMOTE_CACHE="--remote_cache=https://storage.googleapis.com/gvisor-buildkite-bazel-cache/cache-$(date +%Y-%m-%d) --google_default_credentials"
11+
BAZEL_VERSION="$(cat images/default/bazelversion)"
12+
export BAZEL_REMOTE_CACHE="--remote_cache=https://storage.googleapis.com/gvisor-buildkite-bazel-cache/${BAZEL_VERSION}/$(date +%Y-%m-%d) --google_default_credentials"
1213

1314
if POSIXLY_CORRECT=true df --local --output=pcent,ipcent,target | grep -vE '/snap/' | grep -qE '9[4-9]%|100%'; then
1415
echo "Disk usage has reached critical level, node is bad." >&2

images/default/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM ubuntu:22.04
1+
ARG BASE_IMAGE=ubuntu:22.04
2+
FROM $BASE_IMAGE
23

34
ENV DEBIAN_FRONTEND="noninteractive"
45

@@ -7,14 +8,14 @@ ENV DEBIAN_FRONTEND="noninteractive"
78
# equivalents for your distribution:
89
#-------------------------------------------------------------------------------
910
RUN apt-get update && apt-get install -y curl gnupg2 git \
10-
python-is-python3 python3 python3-distutils python3-pip \
11+
python-is-python3 python3 python3-setuptools python3-pip \
1112
build-essential crossbuild-essential-arm64 qemu-user-static \
1213
openjdk-11-jdk-headless zip unzip \
1314
apt-transport-https ca-certificates gnupg-agent \
1415
software-properties-common \
1516
pkg-config libffi-dev patch diffutils libssl-dev iptables kmod \
1617
clang crossbuild-essential-amd64 erofs-utils busybox-static libbpf-dev \
17-
iproute2 netcat libnuma-dev
18+
iproute2 netcat-openbsd libnuma-dev
1819

1920
# This package is needed to build eBPF on amd64, but not on arm64 where it
2021
# doesn't exist.
@@ -33,7 +34,7 @@ RUN add-apt-repository \
3334
RUN apt-get -y install docker-ce-cli
3435

3536
# Install gcloud.
36-
RUN curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-410.0.0-linux-x86_64.tar.gz | \
37+
RUN curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-535.0.0-linux-x86_64.tar.gz | \
3738
tar zxf - google-cloud-sdk && \
3839
google-cloud-sdk/install.sh --quiet && \
3940
ln -s /google-cloud-sdk/bin/gcloud /usr/bin/gcloud

tools/images.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ else
3737
DOCKER_PLATFORM_ARGS :=
3838
endif
3939

40+
DOCKER_BUILD_ARGS ?=
41+
4042
# Note that the image prefixes used here must match the image mangling in
4143
# runsc/testutil.MangleImage. Names are mangled in this way to ensure that all
4244
# tests are using locally-defined images (that are consistent and idempotent).
@@ -158,8 +160,7 @@ pull-%: register-cross ## Force a repull of the image.
158160
rebuild = \
159161
$(call header,REBUILD $(1)) && \
160162
(T=$$(mktemp -d) && cp -a $(call path,$(1))/* $$T && \
161-
$(foreach image,$(shell grep FROM "$(call path,$(1))/$(call dockerfile,$(1))" 2>/dev/null | cut -d' ' -f2),docker pull $(DOCKER_PLATFORM_ARGS) $(image) >&2 &&) \
162-
docker build $(DOCKER_PLATFORM_ARGS) \
163+
set -x && docker build $(DOCKER_PLATFORM_ARGS) $(DOCKER_BUILD_ARGS) \
163164
-f "$$T/$(call dockerfile,$(1))" \
164165
-t "$(call remote_image,$(1)):$(call tag,$(1))" \
165166
-t "$(call remote_image,$(1))":latest \

0 commit comments

Comments
 (0)