Skip to content

Commit

Permalink
Switch to agent-base images
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJosh9000 committed Nov 14, 2024
1 parent 60c7b6e commit 7388de8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 253 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
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:b5428762320f88763d3dbd3949c3416649ac338a3cb57d94c2b1d1a2e403955e
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:f3c1e802c9130bedfdc21d6f3f056d284e286401db19899eb3b3ceb724c2e969
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:91bf621cf16073f237ba353ed8143ffc3a29a3f7bad118d5593decaa14725989
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:5f71c7e0319c7f6d853859928560e1be3161c6bf0c1edad36593eeaeb1776d09
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:5cff2eb2a994edbfdfa5cca8838760d6fc7fb932891e1b46550e113e730bb938
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 7388de8

Please sign in to comment.