Skip to content

Commit

Permalink
Merge pull request #3091 from buildkite/use-agent-base-images
Browse files Browse the repository at this point in the history
Switch to agent-base images
  • Loading branch information
DrJosh9000 authored Nov 18, 2024
2 parents 0927fad + 96223f7 commit 896685c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 260 deletions.
1 change: 0 additions & 1 deletion .buildkite/steps/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ trap "docker buildx rm $builder_name || true" EXIT
echo --- Copying files into build context
cp -a packaging/linux/root/usr/share/buildkite-agent/hooks/ "${packaging_dir}/hooks/"
cp pkg/buildkite-agent-linux-{amd64,arm64} "$packaging_dir"
cp packaging/docker/common/docker-compose "$packaging_dir"

echo "--- Building :docker: $image_tag for all architectures"
docker buildx build --progress plain --builder "$builder_name" --platform linux/amd64,linux/arm64 "$packaging_dir"
Expand Down
12 changes: 5 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ updates:
- /packaging/docker/ubuntu-24.04
schedule:
interval: weekly
ignore:
- dependency-name: ubuntu
- package-ecosystem: gomod
directory: /
schedule:
Expand All @@ -20,12 +18,12 @@ updates:
groups:
otel:
patterns:
- go.opentelemetry.io/*
- go.opentelemetry.io/*
golang-x:
patterns:
- golang.org/x/*
- golang.org/x/*
cloud-providers:
patterns:
- github.com/Azure/*
- github.com/aws/*
- google.golang.org/*
- github.com/Azure/*
- github.com/aws/*
- google.golang.org/*
55 changes: 1 addition & 54 deletions packaging/docker/alpine-k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,9 @@
# syntax=docker/dockerfile:1.4

FROM public.ecr.aws/docker/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d AS base

RUN apk update && apk add --no-cache \
bash \
curl \
docker-cli \
docker-cli-buildx \
docker-cli-compose \
git \
jq \
libc6-compat \
openssh-client \
perl \
py-pip \
rsync \
run-parts \
su-exec \
tini \
tini-static \
tzdata

COPY docker-compose /usr/local/bin/docker-compose

FROM public.ecr.aws/docker/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d AS kubectl-downloader
ARG TARGETOS
ARG TARGETARCH

ENV K8_VERSION=v1.31.0

RUN <<EOF
set -eu
wget -qO kubectl \
"https://storage.googleapis.com/kubernetes-release/release/$K8_VERSION/bin/linux/$TARGETARCH/kubectl"
chmod +x kubectl
EOF

FROM public.ecr.aws/docker/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d AS kustomize-downloader
FROM public.ecr.aws/buildkite/agent-base:alpine-k8s@sha256:7ae077893231e2dc316f5420567118f85b347b5348e4d453ccb2d1dc6a9100ab
ARG TARGETOS
ARG TARGETARCH

RUN <<EOF
set -eu

apk update
apk add jq
URL=$(wget -qO- https://api.github.com/repos/kubernetes-sigs/kustomize/releases | jq -r '.[] | select(has("assets") and .assets != []) | .assets[].browser_download_url' | grep "${TARGETOS}_${TARGETARCH}" | head)
wget -qO- $URL | tar xz
EOF

FROM base AS runtime

ARG TARGETOS
ARG TARGETARCH

COPY --from=kubectl-downloader /kubectl /usr/local/bin/kubectl
COPY --from=kustomize-downloader /kustomize /usr/local/bin/kustomize

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg

RUN mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins \
Expand Down
24 changes: 2 additions & 22 deletions packaging/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
FROM public.ecr.aws/docker/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d
# syntax=docker/dockerfile:1.4

FROM public.ecr.aws/buildkite/agent-base:alpine@sha256:6334b2999afef6a97557eb6f5b60b4dfe6cac1611dde152b9fffc883ee472e30
ARG TARGETOS
ARG TARGETARCH

RUN apk add --no-cache \
bash \
curl \
docker-cli \
docker-cli-compose \
docker-cli-buildx \
git \
jq \
libc6-compat \
openssh-client \
perl \
py-pip \
rsync \
run-parts \
su-exec \
tini \
tini-static \
tzdata

COPY docker-compose /usr/local/bin/docker-compose

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg

RUN mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins \
Expand Down
20 changes: 0 additions & 20 deletions packaging/docker/common/docker-compose

This file was deleted.

57 changes: 5 additions & 52 deletions packaging/docker/ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
# syntax=docker/dockerfile:1.4

FROM public.ecr.aws/ubuntu/ubuntu:20.04@sha256:4a885c102bc7de9ff2ffc4b11b65f35e46827d608069cd959181718aa7d14731

FROM public.ecr.aws/buildkite/agent-base:ubuntu-20.04@sha256:6bcb19149500f017fa4fa75fc2a3c082d3f35df94784594737beaf62568e2613
ARG TARGETOS
ARG TARGETARCH

RUN <<BASH
#!/usr/bin/env bash

set -eufo pipefail

export DEBIAN_FRONTEND=noninteractive

# Install main packages
apt-get update
apt-get install -y --no-install-recommends \
apt-transport-https \
bash \
ca-certificates \
curl \
git \
gnupg-agent \
jq \
openssh-client \
perl \
python3 \
python3-pip \
rsync \
software-properties-common \
tini

# Install Docker Engine
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

# We just updated the main sources. This only updates the docker source
apt-get update -o Dir::Etc::sourcelist="sources.list.d/docker.list" \
-o Dir::Etc::sourceparts="-" \
-o APT::Get::List-Cleanup="0"
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

rm -rf /var/lib/apt/lists/*

ln -s /usr/bin/tini /usr/sbin/tini

mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins
curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh
chmod +x /usr/local/bin/ssh-env-config.sh
BASH

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg \
PATH="/usr/local/bin:${PATH}"

COPY ./docker-compose /usr/local/bin/docker-compose
RUN mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins \
&& curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh \
&& chmod +x /usr/local/bin/ssh-env-config.sh

COPY ./buildkite-agent.cfg /buildkite/buildkite-agent.cfg
COPY ./buildkite-agent-$TARGETOS-$TARGETARCH /usr/local/bin/buildkite-agent
COPY ./entrypoint.sh /usr/local/bin/buildkite-agent-entrypoint
Expand Down
57 changes: 5 additions & 52 deletions packaging/docker/ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
# syntax=docker/dockerfile:1.4

FROM public.ecr.aws/ubuntu/ubuntu:22.04@sha256:1582c29f34a48752e406f1a261fe9545fad895da3f6bb4be55bc82485557564e

FROM public.ecr.aws/buildkite/agent-base:ubuntu-22.04@sha256:ca90fbc56ff1813f486bc3d3787c4d2802f31eede330baf1dde3d6923ee89ea6
ARG TARGETOS
ARG TARGETARCH

RUN <<BASH
#!/usr/bin/env bash

set -eufo pipefail

export DEBIAN_FRONTEND=noninteractive

# Install main packages
apt-get update
apt-get install -y --no-install-recommends \
apt-transport-https \
bash \
ca-certificates \
curl \
git \
gnupg-agent \
jq \
openssh-client \
perl \
python3 \
python3-pip \
rsync \
software-properties-common \
tini

# Install Docker Engine
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

# We just updated the main sources. This only updates the docker source
apt-get update -o Dir::Etc::sourcelist="sources.list.d/docker.list" \
-o Dir::Etc::sourceparts="-" \
-o APT::Get::List-Cleanup="0"
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

rm -rf /var/lib/apt/lists/*

ln -s /usr/bin/tini /usr/sbin/tini

mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins
curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh
chmod +x /usr/local/bin/ssh-env-config.sh
BASH

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg \
PATH="/usr/local/bin:${PATH}"

COPY ./docker-compose /usr/local/bin/docker-compose
RUN mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins \
&& curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh \
&& chmod +x /usr/local/bin/ssh-env-config.sh

COPY ./buildkite-agent.cfg /buildkite/buildkite-agent.cfg
COPY ./buildkite-agent-$TARGETOS-$TARGETARCH /usr/local/bin/buildkite-agent
COPY ./entrypoint.sh /usr/local/bin/buildkite-agent-entrypoint
Expand Down
57 changes: 5 additions & 52 deletions packaging/docker/ubuntu-24.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
# syntax=docker/dockerfile:1.4

FROM public.ecr.aws/ubuntu/ubuntu:24.04@sha256:fb95efe0d22be277f10250f15e5172ec0fe22c37eca2ba55e78b526c447eec23

FROM public.ecr.aws/buildkite/agent-base:ubuntu-24.04@sha256:7a48132055c0356b422b2d6a977987d22af65f14d45c357531dbf290e58b66aa
ARG TARGETOS
ARG TARGETARCH

RUN <<BASH
#!/usr/bin/env bash

set -eufo pipefail

export DEBIAN_FRONTEND=noninteractive

# Install main packages
apt-get update
apt-get install -y --no-install-recommends \
apt-transport-https \
bash \
ca-certificates \
curl \
git \
gnupg-agent \
jq \
openssh-client \
perl \
python3 \
python3-pip \
rsync \
software-properties-common \
tini

# Install Docker Engine
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null

# We just updated the main sources. This only updates the docker source
apt-get update -o Dir::Etc::sourcelist="sources.list.d/docker.list" \
-o Dir::Etc::sourceparts="-" \
-o APT::Get::List-Cleanup="0"
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

rm -rf /var/lib/apt/lists/*

ln -s /usr/bin/tini /usr/sbin/tini

mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins
curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh
chmod +x /usr/local/bin/ssh-env-config.sh
BASH

ENV BUILDKITE_AGENT_CONFIG=/buildkite/buildkite-agent.cfg \
PATH="/usr/local/bin:${PATH}"

COPY ./docker-compose /usr/local/bin/docker-compose
RUN mkdir -p /buildkite/builds /buildkite/hooks /buildkite/plugins \
&& curl -Lfs -o /usr/local/bin/ssh-env-config.sh https://raw.githubusercontent.com/buildkite/docker-ssh-env-config/master/ssh-env-config.sh \
&& chmod +x /usr/local/bin/ssh-env-config.sh

COPY ./buildkite-agent.cfg /buildkite/buildkite-agent.cfg
COPY ./buildkite-agent-$TARGETOS-$TARGETARCH /usr/local/bin/buildkite-agent
COPY ./entrypoint.sh /usr/local/bin/buildkite-agent-entrypoint
Expand Down

0 comments on commit 896685c

Please sign in to comment.