Skip to content

Commit

Permalink
docker_push.sh: Reformat documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Parmann authored and epa095 committed Nov 6, 2018
1 parent 2ff16c0 commit d8769d3
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions docker_push.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
# Script to push an docker image to a docker registry. The docker image can either exist and be
# provided in the env variable DOCKER_IMAGE, or it can be built if DOCKER_IMAGE is empty and DOCKER_FILE is provided.

# Pushes a docker image with name DOCKER_NAME, and tag tag with the 8 first chars of the git commit,
# and if the current commit is tagged it also pushes with those tags. So e.g. if git HEAD is commit "3f6f963" and with tag "0.0.2" then
# two tags are pushed, both "gordo-infrastructure/gordo-deploy:3f6f963" and
# "gordo-infrastructure/gordo-deploy:0.0.2" if DOCKER_NAME is "gordo-infrastructure/gordo-deploy".

# Script to push an docker image to a docker registry. The docker image can
# either exist and be provided in the env variable DOCKER_IMAGE, or it will be
# built if DOCKER_IMAGE is empty and DOCKER_FILE is provided
#
# If $DOCKER_USERNAME is set then it will attempt to log in to the
# $DOCKER_REGISTRY using $DOCKER_USERNAME and DOCKER_PASSWORD, otherwise it
# assumes that you are already logged in.
#
# Pushes a docker image with name DOCKER_NAME, and tag tag with the 8 first
# chars of the git commit, and if the current commit is tagged it also pushes
# with those tags. So e.g. if git HEAD is commit "3f6f963" and with tag "0.0.2"
# then two tags are pushed, both "gordo-infrastructure/gordo-deploy:3f6f963" and
# "gordo-infrastructure/gordo-deploy:0.0.2" if DOCKER_NAME is
# "gordo-infrastructure/gordo-deploy".
#
# Expects the following environment variables to be set:
# DOCKER_NAME: Required. Docker name to push to.
# DOCKER_FILE: Semi-Required. Dockerfile to build. Either DOCKER_IMAGE or DOCKER_FILE must be set.
# DOCKER_IMAGE: Semi-Required. The local docker image to push. Either DOCKER_IMAGE or DOCKER_FILE must be set.
# DOCKER_USERNAME: If set then it uses it an the password to log in to the registry
# DOCKER_PASSWORD: If set then it uses it an the username to log in to the registry
# DOCKER_REGISTRY: Docker registry to push to. Defaults to auroradevacr.azurecr.io
# GORDO_PROD_MODE: If false then pushed tags will include a -dev suffix. Defaults to false
# DOCKER_FILE: Semi-Required. Dockerfile to build. Either DOCKER_IMAGE or
# DOCKER_FILE must be set.
# DOCKER_IMAGE: Semi-Required. The local docker image to push. Either
# DOCKER_IMAGE or DOCKER_FILE must be set.
# DOCKER_USERNAME: If set then it uses it an the password to log in to the
# registry
# DOCKER_PASSWORD: If set then it uses it an the username to log in to the
# registry
# DOCKER_REGISTRY: Docker registry to push to. Defaults to
# auroradevacr.azurecr.io
# GORDO_PROD_MODE: If false then pushed tags will include a -dev suffix.
# Defaults to false

export DOCKER_REGISTRY="${DOCKER_REGISTRY:-auroradevacr.azurecr.io}"
if [[ -z "${DOCKER_NAME}" ]]; then
Expand All @@ -22,7 +35,7 @@ if [[ -z "${DOCKER_NAME}" ]]; then
fi

if [[ -z "${DOCKER_USERNAME}" ]]; then
echo "Since DOCKER_USERNAME is not set we assume you are already logged in to the docker registry"
echo "DOCKER_USERNAME not set: we assume that you are already logged in to the docker registry."
else
# Logging in to the docker registry
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin $DOCKER_REGISTRY
Expand Down

0 comments on commit d8769d3

Please sign in to comment.