Migrate build to build-push-action@v2

This commit is contained in:
Xiaonan Shen 2020-11-19 18:41:16 -08:00
parent 539fa59e63
commit b0ccfe82cb
2 changed files with 33 additions and 31 deletions

View file

@ -1,24 +0,0 @@
#!/bin/bash
set -ex
# Enter the right path
SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH
# Set docker tag
VERSION=`cat VERSION`
if [[ $GITHUB_REF == "refs/heads/master" ]]; then
TAG_TYPE="build"
TAG_VERSION="${VERSION}-build"
else
TAG_TYPE="build-dev"
TAG_VERSION="${VERSION}-build-dev"
fi
# Docker login
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
# Build multiarch and push
docker buildx build $BUILD_ARGS --platform linux/amd64,linux/arm64/v8,linux/arm/v7 -t ${DOCKER_REPO}:${TAG_TYPE} -t ${DOCKER_REPO}:${TAG_VERSION} --push .