summaryrefslogtreecommitdiffstats
path: root/redhat/docker
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2018-12-09 13:38:09 +0100
committerFrançois Andriot <albator78@libertysurf.fr>2018-12-09 13:38:09 +0100
commit2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a (patch)
tree4222ba2f3083a68a84a1dd54085e7fca4515fc5e /redhat/docker
parent82dac1415fe0846a8ddd614b6c901761234eb1db (diff)
downloadtde-packaging-2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a.tar.gz
tde-packaging-2fbb1e0e39fc150603ddc55d8e906df3f0f1f05a.zip
RPM: update build scripts
Diffstat (limited to 'redhat/docker')
-rwxr-xr-xredhat/docker/build.sh14
-rwxr-xr-xredhat/docker/run.sh19
2 files changed, 26 insertions, 7 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
diff --git a/redhat/docker/run.sh b/redhat/docker/run.sh
index 128c53701..639612b4e 100755
--- a/redhat/docker/run.sh
+++ b/redhat/docker/run.sh
@@ -14,19 +14,26 @@ mkdir -p "${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}"
mkdir -p "${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}"
mkdir -p "/dev/shm/docker"
-docker run -t -i --rm --privileged \
+case "${VERSION}" in
+ "14.0."*) TDE_BRANCH="r14.0.x";;
+ *) TDE_BRANCH="master";;
+esac
+
+mkdir -p "${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}" "${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}"
+
+docker run -ti --rm --privileged \
-h "${IMAGE}" \
--name "${IMAGE//:/-}" \
-v /dev/shm/docker:/tmp:z \
-u trinity \
-e TMPPATH=/tmp \
-e TDE_VERSION=${TDE_VERSION} \
- -w /home/trinity/tde/tde-packaging.r14.0.x/redhat \
+ -e TDE_BRANCH=${TDE_BRANCH} \
+ -w /home/trinity/tde/${TDE_BRANCH}/tde-packaging/redhat \
-v ${HOME}/.gnupg:/home/trinity/.gnupg \
- -v ${HOME}/tde/tde-packaging.r14.0.x:/home/trinity/tde/tde-packaging.r14.0.x \
- -v ${HOME}/tde/tde-packaging.master:/home/trinity/tde/tde-packaging.master \
- -v ${HOME}/tde/tde-patches:/home/trinity/tde/tde-patches \
- -v ${HOME}/tde/tde-tarballs:/home/trinity/tde/tde-tarballs \
+ -v ${HOME}/tde/${TDE_BRANCH}/tde-packaging:/home/trinity/tde/${TDE_BRANCH}/tde-packaging \
+ -v ${HOME}/tde/patches:/home/trinity/tde/patches \
+ -v ${HOME}/tde/tarballs:/home/trinity/tde/tarballs \
-v ${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/RPMS.tde-${TDE_VERSION} \
-v ${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/SRPMS.tde-${TDE_VERSION} \
"${IMAGE}" setarch ${ARCH} bash