diff options
author | François Andriot <albator78@libertysurf.fr> | 2018-12-09 13:38:09 +0100 |
---|---|---|
committer | François Andriot <albator78@libertysurf.fr> | 2018-12-09 13:38:09 +0100 |
commit | 2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a (patch) | |
tree | 4222ba2f3083a68a84a1dd54085e7fca4515fc5e /redhat/docker/build.sh | |
parent | 82dac1415fe0846a8ddd614b6c901761234eb1db (diff) | |
download | tde-packaging-2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a.tar.gz tde-packaging-2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a.zip |
RPM: update build scripts
Diffstat (limited to 'redhat/docker/build.sh')
-rwxr-xr-x | redhat/docker/build.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/redhat/docker/build.sh b/redhat/docker/build.sh index 9aeb60f5a..af06b3a6e 100755 --- a/redhat/docker/build.sh +++ b/redhat/docker/build.sh @@ -8,6 +8,18 @@ ARCH="$3" [ -z "${ARCH}" ] && ARCH="x86_64" IMAGE="trinity.${DISTRIB}.${ARCH}:${TDE_VERSION}" +FILE="${HOME}/tde/docker/${IMAGE}.tar.gz" #docker rmi -f "${IMAGE}" -docker build -t "${IMAGE}" -f "${DISTRIB}/Dockerfile.${ARCH}" --build-arg TDE_VERSION="${TDE_VERSION}" --build-arg ARCH="${ARCH}" "${DISTRIB}" + +if [ $(docker images -q "${IMAGE}") ]; then + echo "Docker image '${IMAGE}' already exists." +elif [ -r "${FILE}" ]; then + echo "Importing existing docker image '${FILE}'." + zcat "${FILE}" | docker import - "${IMAGE}" +else + echo "Building new Docker image '${IMAGE}'." + docker build -t "${IMAGE}" -f "${DISTRIB}/Dockerfile.${ARCH}" --build-arg TDE_VERSION="${TDE_VERSION}" --build-arg ARCH="${ARCH}" "${DISTRIB}" + echo "Saving image to '${FILE}'" + docker save "${IMAGE}" | pigz >"${FILE}" +fi |