This repository has been archived on 2022-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
dex/build-docker-push
Brian Waldon b14ce73fa0 *: use example.com in place of coreos.com
Align with RFC2606 for example email addresses, using example.com
in place of coreos.com where appropriate.
2015-12-07 14:55:29 -08:00

20 lines
633 B
Bash
Executable file

#!/bin/bash -e
DOCKER_REGISTRY=${DOCKER_REGISTRY:=quay.io}
DOCKER_REPO=${DOCKER_REPO:=coreos/dex}
repo=$DOCKER_REGISTRY/$DOCKER_REPO
if [ -v $DOCKER_USER ] || [ -v $DOCKER_PASSWORD ]; then
echo "env variables not set: DOCKER_USER, DOCKER_PASSWORD. skipping login, assuming creds in .dockercfg"
else
echo logging in as $DOCKER_USER
docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD" --email="dex@example.com" $DOCKER_REGISTRY
fi
git_sha=$(git rev-parse HEAD)
docker build -q --rm=true -t $repo:$git_sha .
docker tag -f $repo:$git_sha $repo:latest
docker push $repo:$git_sha
docker push $repo:latest