This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/build.sh

24 lines
448 B
Bash
Raw Normal View History

2019-11-12 16:09:47 +00:00
#!/usr/bin/env bash
set -e
if [[ -n "$(git status --porcelain)" ]]; then
echo 'dirty build not supported' >&2
exit 1
fi
# get named head (ex: branch, tag, etc..)
NAME="$( git rev-parse --abbrev-ref HEAD )"
# get 7-character sha
SHA=$( git rev-parse --short HEAD )
# checkout commit so .git/HEAD points to full sha (used in Dockerfile)
git checkout $SHA
REPO=quay.io/quay/quay:$SHA
docker build -t $REPO .
echo $REPO
git checkout "$NAME"