-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·20 lines (14 loc) · 1.06 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh -x
IMG="desktopcontainers/easytag"
PLATFORM="linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
if [ -z ${EASYTAG_VERSION+x} ] || [ -z ${ALPINE_VERSION+x} ]; then
docker-compose build -q --pull --no-cache
export ALPINE_VERSION=$(docker run --rm -ti "$IMG" cat /etc/alpine-release | tail -n1 | tr -d '\r')
export EASYTAG_VERSION=$(docker run --rm -ti "$IMG" apk list 2>/dev/null | grep '\[installed\]' | grep "easytag-[0-9]" | cut -d " " -f1 | sed 's/easytag-//g' | tr -d '\r')
fi
if echo "$@" | grep -v "force" 2>/dev/null >/dev/null; then
echo "check if image was already build and pushed - skip check on release version"
echo "$@" | grep -v "release" && docker pull "$IMG:a$ALPINE_VERSION-et$EASYTAG_VERSION" 2>/dev/null >/dev/null && echo "image already build" && exit 1
fi
docker buildx build -q --pull --no-cache --platform "$PLATFORM" -t "$IMG:a$ALPINE_VERSION-et$EASYTAG_VERSION" --push .
echo "$@" | grep "release" 2>/dev/null >/dev/null && echo ">> releasing new latest" && docker buildx build -q --pull --platform "$PLATFORM" -t "$IMG:latest" --push .