diff options
author | François Andriot <[email protected]> | 2018-12-09 13:38:09 +0100 |
---|---|---|
committer | François Andriot <[email protected]> | 2018-12-09 13:39:00 +0100 |
commit | 728509a18e27b35b2437084dc070ab86ad505bfe (patch) | |
tree | 458fc4a1baf59288a2621bbfd81dbff77fa4638a /redhat/docker/build.sh | |
parent | 1778a4c9ad302e363f739045d4e8ae25f5a40a33 (diff) | |
download | tde-packaging-728509a18e27b35b2437084dc070ab86ad505bfe.tar.gz tde-packaging-728509a18e27b35b2437084dc070ab86ad505bfe.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 |