fix: add docker login and push tag

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias 2018-12-31 18:59:49 +00:00
parent 3c321bf9de
commit cebb1de2af

View File

@ -20,7 +20,8 @@ debugInfo () {
} }
dockerLogin () { dockerLogin () {
gpg --batch --gen-key <<-EOF if [ "$CI" == "true" ]; then
gpg --batch --gen-key <<-EOF
%echo Generating a standard key %echo Generating a standard key
Key-Type: DSA Key-Type: DSA
Key-Length: 1024 Key-Length: 1024
@ -34,14 +35,17 @@ Expire-Date: 0
%echo done %echo done
EOF EOF
key=$(gpg --no-auto-check-trustdb --list-secret-keys | grep ^sec | cut -d/ -f2 | cut -d" " -f1) key=$(gpg --no-auto-check-trustdb --list-secret-keys | grep ^sec | cut -d/ -f2 | cut -d" " -f1)
pass init $key pass init $key
if [ "$(command -v docker-credential-pass)" = "" ]; then if [ "$(command -v docker-credential-pass)" = "" ]; then
docker run --rm -itv /usr/local/bin:/src filebrowser/dev sh -c "cp /go/bin/docker-credential-pass /src" docker run --rm -itv /usr/local/bin:/src filebrowser/dev sh -c "cp /go/bin/docker-credential-pass /src"
fi
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
else
docker login
fi fi
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
} }
dockerPushLatest () { dockerPushLatest () {
@ -51,6 +55,17 @@ dockerPushLatest () {
docker logout docker logout
} }
dockerPushTag () {
dockerLogin
for tag in `echo $(docker images filebrowser/filebrowser* | awk -F ' ' '{print $1 ":" $2}') | cut -d ' ' -f2-`; do
if [ "$tag" = "REPOSITORY:TAG" ]; then break; fi
docker push $tag
done
docker logout
}
installRice () { installRice () {
if ! [ -x "$(command -v rice)" ]; then if ! [ -x "$(command -v rice)" ]; then
go get github.com/GeertJohan/go.rice/rice go get github.com/GeertJohan/go.rice/rice