bin/build
#!/bin/bash
#
# Builds secretless binaries
# usage: ./bin/build
set -ex
. bin/build_utils
CURRENT_DIR=$("$(dirname "$0")/abspath")
TOPLEVEL_DIR="$CURRENT_DIR/.."
KEEP_ALIVE=${KEEP_ALIVE:-}
FULL_VERSION_TAG="$(full_version_tag)"
QUICK_START_DIR="$TOPLEVEL_DIR/demos/quick-start/docker"
# The `Tag` override is there to provide the git commit information in the
# final binary. See `Static long version tags` in the `Building` section
# of `CONTRIBUTING.md` for more information.
DOCKER_FLAGS="--build-arg TAG=$(git_tag)"
if [ "${KEEP_ALIVE}" != "" ]; then
DOCKER_FLAGS="${DOCKER_FLAGS} --rm=false"
else
DOCKER_FLAGS="${DOCKER_FLAGS} --force-rm"
fi
function main() {
retrieve_cyberark_ca_cert
build_docker_images
}
function build_docker_images() {
echo "Building secretless-broker:$FULL_VERSION_TAG Docker image"
# NOTE: the latest tag is required by downstream pipeline stages
# (we want the flags to be word split here)
# shellcheck disable=SC2086
docker build --tag "secretless-broker:${FULL_VERSION_TAG}" \
--tag "secretless-broker:latest" \
--target "secretless-broker" \
$DOCKER_FLAGS \
--file "$TOPLEVEL_DIR/Dockerfile" \
"$TOPLEVEL_DIR"
echo "Building secretless-dev:$FULL_VERSION_TAG Docker image"
# NOTE: the latest tag is required by downstream pipeline stages
# (we want the flags to be word split here)
# shellcheck disable=SC2086
docker build --tag "secretless-dev:${FULL_VERSION_TAG}" \
--tag "secretless-dev:latest" \
$DOCKER_FLAGS \
--file "$TOPLEVEL_DIR/Dockerfile.dev" \
"$TOPLEVEL_DIR"
echo "Building secretless-broker-quickstart:$FULL_VERSION_TAG Docker image"
# NOTE: the latest tag is required by downstream pipeline stages
# (we want the flags to be word split here)
# shellcheck disable=SC2086
docker build --tag "secretless-broker-quickstart:${FULL_VERSION_TAG}" \
--tag "secretless-broker-quickstart:latest" \
$DOCKER_FLAGS \
--file "$QUICK_START_DIR/Dockerfile" \
"$QUICK_START_DIR"
echo "Building secretless-broker-redhat:$FULL_VERSION_TAG Docker image"
# (we want the flags to be word split here)
# shellcheck disable=SC2086
docker build --tag "secretless-broker-redhat:${FULL_VERSION_TAG}" \
--target "secretless-broker-redhat" \
--build-arg VERSION="${FULL_VERSION_TAG}" \
$DOCKER_FLAGS \
--file "$TOPLEVEL_DIR/Dockerfile" \
"$TOPLEVEL_DIR"
echo "Building secretless-broker-coverage:$FULL_VERSION_TAG Docker image"
# NOTE: the latest tag is required by downstream pipeline stages
# (we want the flags to be word split here)
# shellcheck disable=SC2086
docker build --tag "secretless-broker-coverage:${FULL_VERSION_TAG}" \
--tag "secretless-broker-coverage:latest" \
$DOCKER_FLAGS \
--file "$TOPLEVEL_DIR/Dockerfile.coverage" \
"$TOPLEVEL_DIR"
}
main