Verified Commit 6f93853e authored by noplanman's avatar noplanman

Use 1.1.10 as hot base image and test borg binary by outputting the version number.

parent 1c1edeb6
# Base image to build the binaries from, based on BorgBackup version 1.1.0 # Base image to build the binaries from, based on BorgBackup version 1.1.10
ARG BORG_ARCH ARG BORG_ARCH
FROM balenalib/${BORG_ARCH}-python:3.5-jessie-run FROM balenalib/${BORG_ARCH}-python:3.5-jessie-run
...@@ -20,13 +20,14 @@ RUN set -ex; \ ...@@ -20,13 +20,14 @@ RUN set -ex; \
zlib1g-dev liblz4-dev; \ zlib1g-dev liblz4-dev; \
rm -rf /var/lib/apt/lists/*; rm -rf /var/lib/apt/lists/*;
# fetch borg source code for version 1.1.0 and update pip # fetch borg source code for version 1.1.10 and update pip
RUN set -ex; \ RUN set -ex; \
git clone -b 1.1.0 https://github.com/borgbackup/borg.git .; \ git clone -b 1.1.10 https://github.com/borgbackup/borg.git .; \
pip install --upgrade pip; pip install --upgrade pip;
# install all requirements # install all requirements
RUN set -ex; \ RUN set -ex; \
pip install -r requirements.d/development.txt; \ pip install -r requirements.d/development.txt; \
pip install -r requirements.d/fuse.txt; \ pip install -r requirements.d/fuse.txt; \
pip install -e .[fuse]; \
pip install pyinstaller; pip install pyinstaller;
ARG BORG_ARCH ARG BORG_ARCH
FROM noplanman/borg-binary-builder:base-1.1.0-${BORG_ARCH} FROM noplanman/borg-binary-builder:base-1.1.10-${BORG_ARCH}
ARG BORG_ARCH ARG BORG_ARCH
ARG BORG_VERSION=1.1.10 ARG BORG_VERSION=1.1.10
......
...@@ -12,9 +12,11 @@ See the [list of available architectures] ([on GitHub][available-architectures-g ...@@ -12,9 +12,11 @@ See the [list of available architectures] ([on GitHub][available-architectures-g
*Examples:* *Examples:*
- Build version `1.1.10` for `aarch64` - Build version `1.1.10` for `aarch64`
`./build.sh aarch64 1.1.10` `./build.sh aarch64 1.1.10`
- Build version `1.1.5` for Raspberry Pi 3 - Build version `1.1.5` for Raspberry Pi 3
`./build.sh raspberrypi3 1.1.5` `./build.sh raspberrypi3 1.1.5`
### Extract borg binary ### Extract borg binary
...@@ -25,22 +27,26 @@ See the [list of available architectures] ([on GitHub][available-architectures-g ...@@ -25,22 +27,26 @@ See the [list of available architectures] ([on GitHub][available-architectures-g
*Examples:* *Examples:*
- Extract borg `1.1.10` binary for `aarch64` to `borg-aarch64` in current folder - Extract borg `1.1.10` binary for `aarch64` to `borg-aarch64` in current folder
`./extract.sh aarch64 1.1.10 borg-aarch64` `./extract.sh aarch64 1.1.10 borg-aarch64`
- Extract borg `1.1.5` binary for Raspberry Pi 3 to `/homes/lemoi/borg` - Extract borg `1.1.5` binary for Raspberry Pi 3 to `/homes/lemoi/borg`
`./extract.sh raspberrypi3 1.1.5 /homes/lemoi/borg` `./extract.sh raspberrypi3 1.1.5 /homes/lemoi/borg`
### Build base image ### Build base image
To speed up the building process, certain architectures have a prebuilt base image with the development requirements already installed. To speed up the building process, certain architectures have a prebuilt base image with the development requirements already installed.
These base images are based on BorgBackup version 1.1.0.
These base images are based on BorgBackup version 1.1.0 *(for versions 1.1.0 to 1.1.9)* and 1.1.10 *(for versions 1.1.10 and later)*.
Adding a new architecture to the base image list and pushing it to docker hub: Adding a new architecture to the base image list and pushing it to docker hub:
`./build-base.sh <arch>` `./build-base.sh <arch>`
*Examples:* *Examples:*
- Build base image for `aarch64` - Build base image for `aarch64`:
`./build-base.sh aarch64` `./build-base.sh aarch64`
## How this works ## How this works
...@@ -56,6 +62,7 @@ Then, the docker image is built for the requested architecture. ...@@ -56,6 +62,7 @@ Then, the docker image is built for the requested architecture.
This is basically done by following the flow of setting up a [BorgBackup development environment] and [creating the standalone binary]. (For more info on this, just have a look at the `Dockerfile`) This is basically done by following the flow of setting up a [BorgBackup development environment] and [creating the standalone binary]. (For more info on this, just have a look at the `Dockerfile`)
When using the base images created by `build-base.sh`, instead of using the normal `Dockerfile`, you can set the `BBB_HOT` environment variable to any value, which makes the build script use `Dockerfile.hot`. When using the base images created by `build-base.sh`, instead of using the normal `Dockerfile`, you can set the `BBB_HOT` environment variable to any value, which makes the build script use `Dockerfile.hot`.
The build then starts off with the prebuilt base image, speeding up the build tremendously. The build then starts off with the prebuilt base image, speeding up the build tremendously.
Builds are based on the Python 3.5 images on Debian Jessie. Builds are based on the Python 3.5 images on Debian Jessie.
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
# For available architectures see: # For available architectures see:
# https://www.balena.io/docs/reference/base-images/base-images/#balena-base-images # https://www.balena.io/docs/reference/base-images/base-images/#balena-base-images
set -ex
BORG_ARCH=${1} BORG_ARCH=${1}
if [ -z "${BORG_ARCH}" ]; then if [ -z "${BORG_ARCH}" ]; then
...@@ -16,7 +18,7 @@ if [ -z "${BORG_ARCH}" ]; then ...@@ -16,7 +18,7 @@ if [ -z "${BORG_ARCH}" ]; then
exit 1; exit 1;
fi fi
DOCKER_IMAGE=noplanman/borg-binary-builder:base-1.1.0-${BORG_ARCH} DOCKER_IMAGE=noplanman/borg-binary-builder:base-1.1.10-${BORG_ARCH}
echo "Building ${DOCKER_IMAGE}" echo "Building ${DOCKER_IMAGE}"
...@@ -28,5 +30,8 @@ docker build \ ...@@ -28,5 +30,8 @@ docker build \
-t "${DOCKER_IMAGE}" \ -t "${DOCKER_IMAGE}" \
-f Dockerfile.base . -f Dockerfile.base .
# Output built borg binary version to assure the binary works.
docker run --rm "${DOCKER_IMAGE}" borg --version
echo "Pushing to docker hub" echo "Pushing to docker hub"
docker push "${DOCKER_IMAGE}" docker push "${DOCKER_IMAGE}"
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
# For available architectures see: # For available architectures see:
# https://www.balena.io/docs/reference/base-images/base-images/#balena-base-images # https://www.balena.io/docs/reference/base-images/base-images/#balena-base-images
set -ex
BORG_ARCH=${1} BORG_ARCH=${1}
BORG_VERSION=${2:-1.1.10} BORG_VERSION=${2:-1.1.10}
...@@ -34,3 +36,6 @@ docker build \ ...@@ -34,3 +36,6 @@ docker build \
--build-arg "BORG_VERSION=${BORG_VERSION}" \ --build-arg "BORG_VERSION=${BORG_VERSION}" \
-t "${DOCKER_IMAGE}" \ -t "${DOCKER_IMAGE}" \
-f "${DOCKER_FILE}" . -f "${DOCKER_FILE}" .
# Output built borg binary version to assure the binary works.
docker run --rm "${DOCKER_IMAGE}" borg --version
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment