Add ci script to generate docker image
This commit is contained in:
33
ci/create-docker-image.sh
Normal file
33
ci/create-docker-image.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Signed by TECC-SE - T524467 (Logan MAUZAIZE)
|
||||
|
||||
basedir="${bamboo_build_working_directory}"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
function main() {
|
||||
which docker >/dev/null 2>&1 || {
|
||||
echo "'docker' command is required" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
local image_version="${bamboo_deploy_release}"
|
||||
local image_revision="${bamboo_planRepository_1_revision}"
|
||||
local image_basetag='nexusoss-docker-int.airfrance.fr/sspt/sspt-retro'
|
||||
local image_tag="${image_basetag}:${image_version}"
|
||||
|
||||
{
|
||||
echo "Generating Docker image '${image_tag}'" && \
|
||||
docker build -t "${image_tag}" --build-arg "version=${image_version}" --build-arg "revision=${image_revision}" --build-arg "tag=${image_tag}" "${basedir}/assets/docker" && \
|
||||
echo "Pushing Docker image '${image_tag}'" && \
|
||||
docker push "${image_tag}"
|
||||
} || {
|
||||
local rc="$?"
|
||||
echo "Removing Docker image '${image_tag}'" && \
|
||||
docker rmi "${image_tag}"
|
||||
return "${rc}"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user