shlink/docker/build

26 lines
781 B
Plaintext
Raw Normal View History

#!/bin/bash
set -ex
PLATFORMS="linux/arm/v7,linux/arm64/v8,linux/amd64"
DOCKER_IMAGE="shlinkio/shlink"
2020-05-05 14:58:23 -05: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 11:40:20 -05:00
2020-05-05 14:58:23 -05:00
docker buildx build --push \
--build-arg SHLINK_VERSION=${VERSION} \
--platform ${PLATFORMS} \
2020-05-15 11:40:20 -05:00
${TAGS} .
# If build branch is develop, build latest
elif [[ "$GITHUB_REF" == *"develop"* ]]; then
2020-05-05 14:58:23 -05:00
docker buildx build --push \
--platform ${PLATFORMS} \
2020-05-17 03:19:54 -05:00
-t ${DOCKER_IMAGE}:latest .
fi