2017-01-05 14:35:38 +00:00
#!/bin/bash
#
# build hook for dockerhubs autobuild feature
#
2017-07-22 13:14:20 +00:00
set -ex
2017-01-05 14:35:38 +00:00
. "hooks/config"
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do
2017-07-22 13:14:20 +00:00
if [ ${TRAVIS} == 'true' ]; then
2017-07-23 15:18:50 +00:00
echo "Build Zammad Docker image ${DOCKER_IMAGE} with version ${TRAVIS_BUILD_NUMBER} for DockerHubs ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} repo"
2017-07-22 13:14:20 +00:00
2017-07-23 15:18:50 +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}-${TRAVIS_BUILD_NUMBER} -f containers/${DOCKER_IMAGE}/Dockerfile .
2017-07-22 13:14:20 +00:00
2017-07-23 15:18:50 +00:00
docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}
2017-01-05 14:35:38 +00:00
2017-07-23 15:18:50 +00:00
docker push ${DOCKER_REGISTRY}/${GITHUB_USERNAME}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${TRAVIS_BUILD_NUMBER}
2017-07-22 13:14:20 +00:00
else
2017-01-05 14:35:38 +00:00
echo "Build Zammad Docker image ${DOCKER_IMAGE} for DockerHubs ${DOCKER_REPO}:${DOCKER_IMAGE} repo"
2017-07-22 13:14:20 +00:00
2017-01-12 16:09:55 +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 .
2017-01-05 14:35:38 +00:00
2017-07-22 13:14:20 +00:00
docker push ${DOCKER_REPO}:${DOCKER_IMAGE}
fi
2017-01-05 14:35:38 +00:00
done