build.sh 670 Bytes
Newer Older
noplanman's avatar
noplanman committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env bash

# Usage: ./build.sh <arch> [<version>]

# For available architectures see:
# https://docs.resin.io/reference/base-images/base-images/

BORG_ARCH=${1}
BORG_VERSION=${2:-1.1.7}

if [ -z "${BORG_ARCH}" ]; then
    echo "Usage: ./build.sh <arch> [<version>]";
    echo "- No arch provided -";
    exit 1;
fi

echo "Building BorgBackup ${BORG_VERSION} for ${BORG_ARCH}"

# https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/
docker run --rm --privileged multiarch/qemu-user-static:register --reset

docker build \
    --build-arg "BORG_ARCH=${BORG_ARCH}" \
    --build-arg "BORG_VERSION=${BORG_VERSION}" \
    -t "borg:${BORG_ARCH}" .