Skip to content

Commit

Permalink
Move alpine docker image to specific sub-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lox committed Apr 29, 2018
1 parent b1d4bf2 commit ad1ee6d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions .buildkite/steps/build-docker-images.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
#!/bin/bash
set -e

build_alpine_docker_image() {
local image_tag="$1"

echo "--- Building :docker: $image_tag"
cp pkg/buildkite-agent-linux-amd64 packaging/docker/linux/buildkite-agent
chmod +x packaging/docker/linux/buildkite-agent
docker build --tag "$image_tag" packaging/docker/linux
}

test_docker_image() {
local image_tag="$1"

echo "--- :hammer: Testing $image_tag can run"
docker run --rm --entrypoint "buildkite-agent" "$image_tag" --version

echo "--- :hammer: Testing $image_tag can access docker socket"
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --entrypoint "docker" "$image_tag" version

echo "--- :hammer: Testing $image_tag has docker-compose"
docker run --rm --entrypoint "docker-compose" "$image_tag" --version
}

echo '--- Getting agent version from build meta data'

image_tag=$(buildkite-agent meta-data get "agent-docker-image-alpine")
Expand All @@ -13,19 +35,9 @@ mkdir -p pkg
echo '--- Downloading :linux: binaries'
buildkite-agent artifact download "pkg/buildkite-agent-linux-amd64" .

echo '--- Building :docker: image'
cp pkg/buildkite-agent-linux-amd64 packaging/docker/linux/buildkite-agent
chmod +x packaging/docker/linux/buildkite-agent
docker build --tag "$image_tag" packaging/docker/linux

echo "--- :hammer: Testing $image_tag can run"
docker run --rm --entrypoint "buildkite-agent" "$image_tag" --version

echo "--- :hammer: Testing $image_tag can access docker socket"
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --entrypoint "docker" "$image_tag" version
build_alpine_docker_image "$image_tag"

echo "--- :hammer: Testing $image_tag has docker-compose"
docker run --rm --entrypoint "docker-compose" "$image_tag" --version
test_docker_image "$image_tag"

echo '--- Pushing :docker: image to buildkiteci/agent'
docker push "$image_tag"
File renamed without changes.
File renamed without changes.

0 comments on commit ad1ee6d

Please sign in to comment.