forked from themorlan/docker_urbackup
-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.sh
38 lines (33 loc) · 920 Bytes
/
build.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -x
# Accepted values for ARCH are amd64, armhf, arm64, i386
ARCH=${1:-amd64}
VERSION=${2:-2.4.15}
OPTS=${3}
TAG=${VERSION}_${ARCH}
case ${ARCH} in
"amd64") IMAGE_ARCH="$BASE" ;;
"armhf") IMAGE_ARCH="arm32v7/$BASE" ;;
"arm64") IMAGE_ARCH="arm64v8/$BASE" ;;
"i386") IMAGE_ARCH="i386/$BASE" ;;
*) echo "unrecognized architecture '$ARCH'" >>/dev/stderr ; exit 1 ;;
esac
if [[ " ${*} " =~ " btrfs " ]]; then
BTRFS=1
TAG=${TAG}_btrfs
fi
if [[ " ${*} " =~ " zfs " ]]; then
if [[ "$ARCH" != "amd64" ]]; then
echo "ZFS is only supported on amd64" ; exit 0
fi
ZFS=1
TAG=${TAG}_zfs
fi
docker build \
--build-arg ARCH=${ARCH} \
--build-arg VERSION=${VERSION} \
--build-arg IMAGE_ARCH=${IMAGE_ARCH} \
--build-arg BTRFS=${BTRFS} \
--build-arg ZFS=${ZFS} \
-t urbackup-server:${TAG} \
.