zammad-docker-compose/hooks/build

38 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash
#
# build hook for dockerhubs autobuild feature
#
2019-02-15 15:52:40 +00:00
set -e
. "hooks/config"
2019-02-15 15:52:40 +00:00
#shellcheck disable=SC2153
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do
2019-02-11 15:09:58 +00:00
if [ "${TRAVIS}" == 'true' ] || [ "${CIRCLECI}" == 'true' ]; then
if [ -n "${ZAMMAD_VERSION}" ]; then
DOCKER_TAG="-t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION}"
2017-10-03 08:36:03 +00:00
else
ZAMMAD_VERSION="latest"
fi
echo "Build Zammad Docker image ${DOCKER_IMAGE} with version ${ZAMMAD_VERSION} for DockerHubs ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} repo"
2019-02-15 15:52:40 +00:00
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} -t ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-latest ${DOCKER_TAG} -f containers/${DOCKER_IMAGE}/Dockerfile .
2017-07-23 15:18:50 +00:00
docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}
2019-02-15 15:52:40 +00:00
docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-latest
2017-10-03 08:44:54 +00:00
if [ "${ZAMMAD_VERSION}" != "latest" ]; then
docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION}
2019-02-09 17:56:25 +00:00
fi
else
echo "Build Zammad Docker image ${DOCKER_IMAGE} for DockerHubs ${DOCKER_REPO}:${DOCKER_IMAGE} repo"
2019-02-09 17:56:25 +00:00
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_REPO}:${DOCKER_IMAGE}" -f containers/"${DOCKER_IMAGE}"/Dockerfile .
docker push ${DOCKER_REPO}:${DOCKER_IMAGE}
fi
done