|
|
@ -36,14 +36,15 @@ do |
|
|
|
# contents of the docker image always changes the SHA (e.g. using "ADD file" |
|
|
|
# contents of the docker image always changes the SHA (e.g. using "ADD file" |
|
|
|
# cmd in the dockerfile in not ok as contents of the added file will not be |
|
|
|
# cmd in the dockerfile in not ok as contents of the added file will not be |
|
|
|
# reflected in the SHA). |
|
|
|
# reflected in the SHA). |
|
|
|
DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) |
|
|
|
DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR) |
|
|
|
|
|
|
|
DOCKER_IMAGE_TAG=$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) |
|
|
|
|
|
|
|
|
|
|
|
# skip the image if it already exists in the repo |
|
|
|
# skip the image if it already exists in the repo |
|
|
|
curl --silent -f -lSL https://registry.hub.docker.com/v2/repositories/${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}/tags/latest > /dev/null \ |
|
|
|
curl --silent -f -lSL https://registry.hub.docker.com/v2/repositories/${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}/tags/${DOCKER_IMAGE_TAG} > /dev/null \ |
|
|
|
&& continue |
|
|
|
&& continue |
|
|
|
|
|
|
|
|
|
|
|
docker build -t ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME} ${DOCKERFILE_DIR} |
|
|
|
docker build -t ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKERFILE_DIR} |
|
|
|
|
|
|
|
|
|
|
|
# "docker login" needs to be run in advance |
|
|
|
# "docker login" needs to be run in advance |
|
|
|
docker push ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME} |
|
|
|
docker push ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} |
|
|
|
done |
|
|
|
done |
|
|
|