20 lines
628 B
Bash
Executable file
20 lines
628 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
|
|
|
|
version=$(./git-version)
|
|
|
|
docker build -q --rm=true -t $repo:$version .
|
|
docker tag -f $repo:$version $repo:latest
|
|
docker push $repo:$version
|
|
docker push $repo:latest
|