shlink/docker/build

26 lines
781 B
Text
Raw Normal View History

#!/bin/bash
set -ex
PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
DOCKER_IMAGE="shlinkio/shlink"
2020-05-05 22:58:23 +03:00
# If ref is not develop, then this is a tag. Build that docker tag and also "stable"
if [[ "$GITHUB_REF" != *"develop"* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
TAGS="-t ${DOCKER_IMAGE}:${VERSION}"
# Push stable tag only if this is not an alpha or beta tag
[[ $GITHUB_REF != *"alpha"* && $GITHUB_REF != *"beta"* ]] && TAGS="${TAGS} -t ${DOCKER_IMAGE}:stable"
2020-05-15 19:40:20 +03:00
2020-05-05 22:58:23 +03:00
docker buildx build --push \
--build-arg SHLINK_VERSION=${VERSION} \
--platform ${PLATFORMS} \
2020-05-15 19:40:20 +03:00
${TAGS} .
# If build branch is develop, build latest
elif [[ "$GITHUB_REF" == *"develop"* ]]; then
2020-05-05 22:58:23 +03:00
docker buildx build --push \
--platform ${PLATFORMS} \
2020-05-17 11:19:54 +03:00
-t ${DOCKER_IMAGE}:latest .
fi