Skip to content

Commit

Permalink
Add variants for btrfs and zfs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon authored and Jon committed May 22, 2022
1 parent a281ab9 commit efebbc4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 26 deletions.
50 changes: 30 additions & 20 deletions Dockerfile
@@ -1,33 +1,43 @@
# Base image can be specified by --build-arg IMAGE_ARCH= ; defaults to debian:buster
ARG IMAGE_ARCH=debian:buster
# Base image can be specified by --build-arg IMAGE_ARCH= ; defaults to debian:bullseye
ARG IMAGE_ARCH=debian:bullseye
FROM ${IMAGE_ARCH}

ENV DEBIAN_FRONTEND=noninteractive
ARG VERSION=2.4.15
ENV VERSION ${VERSION}
ARG TARGETPLATFORM
ARG DEBIAN=bullseye
ARG BTRFS
ARG ZFS

COPY entrypoint.sh /usr/bin/

RUN case ${TARGETPLATFORM} in \
"linux/amd64") URL=https://hndl.urbackup.org/Server/${VERSION}/debian/buster/urbackup-server_${VERSION}_amd64.deb ;; \
"linux/arm64") URL=https://hndl.urbackup.org/Server/${VERSION}/urbackup-server_${VERSION}_arm64.deb ;; \
"linux/arm/v7") URL=https://hndl.urbackup.org/Server/${VERSION}/urbackup-server_${VERSION}_armhf.deb ;; \
"linux/386") URL=https://hndl.urbackup.org/Server/${VERSION}/debian/buster/urbackup-server_${VERSION}_i386.deb ;; \
RUN URL=https://hndl.urbackup.org/Server/${VERSION} && \
case ${TARGETPLATFORM} in \
"linux/amd64") URL=$URL/debian/${DEBIAN}/urbackup-server_${VERSION}_amd64.deb ;; \
"linux/arm64") URL=$URL/urbackup-server_${VERSION}_arm64.deb ;; \
"linux/arm/v7") URL=$URL/urbackup-server_${VERSION}_armhf.deb ;; \
"linux/386") URL=$URL/debian/${DEBIAN}/urbackup-server_${VERSION}_i386.deb ;; \
esac \
&& apt-get update \
&& apt-get install -y wget \
&& wget -q "$URL" -O /root/urbackup-server.deb \
&& echo "urbackup-server urbackup/backuppath string /backups" | debconf-set-selections \
&& apt-get install -y --no-install-recommends /root/urbackup-server.deb btrfs-tools \
&& rm /root/urbackup-server.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Backing up www-folder
RUN mkdir /web-backup && cp -R /usr/share/urbackup/* /web-backup
# Making entrypoint-script executable
RUN chmod +x /usr/bin/entrypoint.sh
&& dry="http://deb.debian.org/debian ${DEBIAN}-backports main contrib" \
&& echo "deb $dry\ndeb-src $dry" >/etc/apt/sources.list.d/${DEBIAN}-backports.list \
&& apt-get update \
&& apt-get install -y wget \
&& wget -q "$URL" -O /root/urbackup-server.deb \
&& apt-get remove -y wget \
&& apt-get autoremove -y \
&& echo "urbackup-server urbackup/backuppath string /backups" \
| debconf-set-selections \
&& apt-get install -y --no-install-recommends \
/root/urbackup-server.deb \
${BTRFS:+btrfs-progs} \
${ZFS:+zfsutils-linux} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/${DEBIAN}-backports.list \
/root/urbackup-server.deb \
&& cp -R /usr/share/urbackup /web-backup \
&& chmod +x /usr/bin/entrypoint.sh

EXPOSE 55413
EXPOSE 55414
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -24,6 +24,8 @@ docker run -d \

For BTRFS-Support add `--cap-add SYS_ADMIN` to the command above

For ZFS support add `--device /dev/zfs` to the command above

If you want to externally bind-mount the www-folder add `-v /path/to/wwwfolder:/usr/share/urbackup`

### Or via docker-compose (compatible with stacks in Portainer):
Expand Down
37 changes: 31 additions & 6 deletions build.sh
Expand Up @@ -3,11 +3,36 @@ set -x

# Accepted values for ARCH are amd64, armhf, arm64, i386
ARCH=${1:-amd64}
VERSION=${2:-2.4.13}
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=$([ "${ARCH}" == "armhf" ] && echo "arm32v7/debian:stretch" || ([ "${ARCH}" == "arm64" ] && echo "arm64v8/debian:stretch") || ([ "${BUILD_ARCH}" == "i386" ] && echo "i386/debian:stretch") || echo "debian:stretch") \
-t urbackup-server:${VERSION}_${ARCH} \
.
--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} \
.

0 comments on commit efebbc4

Please sign in to comment.