build.sh 710 Bytes
Newer Older
noplanman's avatar
noplanman committed
1
#!/usr/bin/env sh
noplanman's avatar
noplanman committed
2 3 4 5 6 7 8 9 10

# 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}

noplanman's avatar
noplanman committed
11 12
DOCKER_IMAGE=borg:${BORG_VERSION}-${BORG_ARCH}

noplanman's avatar
noplanman committed
13 14
if [ -z "${BORG_ARCH}" ]; then
    echo "Usage: ./build.sh <arch> [<version>]";
noplanman's avatar
noplanman committed
15
    echo "No arch provided";
noplanman's avatar
noplanman committed
16 17 18 19 20 21 22 23 24 25 26
    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}" \
noplanman's avatar
noplanman committed
27
    -t "${DOCKER_IMAGE}" .