Add ci script to generate docker image
This commit is contained in:
19
ci/asset/Dockerfile
Normal file
19
ci/asset/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# we are extending everything from tomcat:8.0 image ...
|
||||||
|
FROM tomcat:7.0
|
||||||
|
MAINTAINER boube astugue antoine
|
||||||
|
|
||||||
|
ARG version
|
||||||
|
ARG revision
|
||||||
|
ARG tag
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.authors="Maxime Chassagneux (ITOP BD) EXT"
|
||||||
|
LABEL org.opencontainers.image.url="https://bitbucket.devnet.klm.com/projects/TCPOW/repos/connectors/browse"
|
||||||
|
LABEL org.opencontainers.image.source="https://bitbucket.devnet.klm.com/projects/TCPOW/repos/connectors/browse"
|
||||||
|
LABEL org.opencontainers.image.version="${version}"
|
||||||
|
LABEL org.opencontainers.image.revision="${revision}"
|
||||||
|
LABEL org.opencontainers.image.vendor="ITOP BD"
|
||||||
|
LABEL org.opencontainers.image.ref.name="${tag}"
|
||||||
|
|
||||||
|
# COPY path-to-your-application-war path-to-webapps-in-docker-tomcat
|
||||||
|
COPY ./target/RetroV-?.?.?-SNAPSHOT.war /usr/local/tomcat/webapps/
|
||||||
|
|
||||||
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