Skip to content

Commit

Permalink
fix: backport package-docker-snapshot.sh script (#4424)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuisathaverat committed Nov 18, 2020
1 parent c191426 commit c446e3a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions script/jenkins/package-docker-snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
#
# Build the docker image for the apm-server, retag and push it to the given docker registry
#
# Arguments:
# - NEW_TAG, this is the tag for the docker image to be pushed.
# - NEW_IMAGE, this is the docker image name to be pushed.
#
set -euo pipefail

NEW_TAG=${1:?Docker tag is not set}
NEW_IMAGE=${2:?Docker image is not set}

export PLATFORMS='linux/amd64'
export TYPE='docker'
export SNAPSHOT='true'
export IMAGE="docker.elastic.co/apm/apm-server"

echo 'INFO: Build docker images'
make release

echo 'INFO: Get the just built docker image'
TAG=$(docker images ${IMAGE} --format "{{.Tag}}" | head -1)

echo "INFO: Retag docker image (${IMAGE}:${TAG})"
docker tag "${IMAGE}:${TAG}" "${NEW_IMAGE}:${NEW_TAG}"

echo "INFO: Push docker image (${NEW_IMAGE}:${NEW_TAG})"
docker push "${NEW_IMAGE}:${NEW_TAG}"

0 comments on commit c446e3a

Please sign in to comment.