UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 9d61bc2a authored by Scott Stroud's avatar Scott Stroud
Browse files

rm build-image.sh

parent 26154efb
No related branches found
No related tags found
2 merge requests!23Development,!227.2.1
Pipeline #915914 failed
#!/bin/bash
start=`date +%s`
##
# Docker Dependencies:
# https://docs.confluent.io/current/installation/docker/image-reference.html#image-reference
##
# Settings for the build process
if [[ -f .env ]]; then
echo "Loading in '.env' for values ..."
export $(grep -v '^#' .env | xargs)
echo " "
elif [[ -f ../.env ]]; then
echo "Loading in PARENT '.env' for values ..."
export $(grep -v '^#' ../.env | xargs)
echo " "
fi
# The BASE_ is used by PlatformOne to change the base image, we will make use of RedHat
BASE_REGISTRY=${BASE_REGISTRY:-'registry1.dso.mil'}
MANI='hardening_manifest.yaml'
## parse manifest with yq (https://github.com/mikefarah/yq)
name=$(yq e '.name' $MANI)
tags=( $(yq e '.tags.[]' $MANI) )
baseImage=$(yq e '.args.BASE_IMAGE' $MANI)
baseTag=$(yq e '.args.BASE_TAG' $MANI)
echo "Starting $name build ..."
echo "$name docker build ..."
if [[ "$1" == "--squash" ]]; then
echo "Squashing like a cockroach ..."
DOCKER_BUILDKIT=1 docker build \
--squash \
--tag $BASE_REGISTRY/$name:latest \
--build-arg BASE_REGISTRY=$BASE_REGISTRY \
--build-arg BASE_IMAGE=$baseImage \
--build-arg BASE_TAG=$baseTag \
.
else
DOCKER_BUILDKIT=1 docker build \
--tag $BASE_REGISTRY/$name:latest \
--build-arg BASE_REGISTRY=$BASE_REGISTRY \
--build-arg BASE_IMAGE=$baseImage \
--build-arg BASE_TAG=$baseTag \
.
fi
for tag in "${tags[@]}";do
docker tag $BASE_REGISTRY/$name:latest $BASE_REGISTRY/$name:$tag
echo "🏷 Tagged build with $BASE_REGISTRY/$name:$tag"
done
end=`date +%s`
duration=$((end-start))
echo "🏁 Finished $CONTAINER build (${duration} seconds)"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment