Created
May 9, 2017 09:41
-
-
Save ronalddddd/5d207bfe00a39bc683a049c6dd87cd1f to your computer and use it in GitHub Desktop.
Docker build and push script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
REGISTRY=registry.gitlab.com | |
REGISTRY_GROUP=${REGISTRY_GROUP:=acme} | |
REGISTRY_USERNAME=${REGISTRY_USERNAME:=${REGISTRY_GROUP}-ci} | |
PROJECT_NAME="${PWD##*/}" | |
IMAGE_TAG=${IMAGE_TAGE:=latest} | |
IMAGE_NAME=${REGISTRY}/${REGISTRY_GROUP}/${PROJECT_NAME}:${IMAGE_TAG} | |
echo "BUILD TARGET: ${REGISTRY_USERNAME}@${IMAGE_NAME}" | |
docker login ${REGISTRY} --username ${REGISTRY_USERNAME} --password ${REGISTRY_PASSWORD} | |
docker build -t ${IMAGE_NAME} . | |
docker push ${IMAGE_NAME} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment