From 085ff89a4e3ca07f9178e7e49cd37228408922a2 Mon Sep 17 00:00:00 2001 From: Adrien le Maire Date: Mon, 8 Feb 2021 11:11:08 +0000 Subject: [PATCH] Update borg/Dockerfile, borg/Makefile, borg/version, .gitlab-ci.yml files --- .gitlab-ci.yml | 11 +++++++++++ borg/Dockerfile | 19 +++++++++++++++++++ borg/Makefile | 18 ++++++++++++++++++ borg/version | 1 + 4 files changed, 49 insertions(+) create mode 100644 borg/Dockerfile create mode 100644 borg/Makefile create mode 100644 borg/version diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 235ce2e..b7636f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -150,6 +150,17 @@ roundcubemail: variables: - $CI_COMMIT_REF_PROTECTED == "true" +borg: + stage: build + tags: + - docker + script: + - cd borg + - make push + only: + variables: + - $CI_COMMIT_REF_PROTECTED == "true" + .docker_init: &docker_init | if ! docker info &>/dev/null; then if [ -z "${DOCKER_HOST}" -a "${KUBERNETES_PORT}" ]; then diff --git a/borg/Dockerfile b/borg/Dockerfile new file mode 100644 index 0000000..31a6918 --- /dev/null +++ b/borg/Dockerfile @@ -0,0 +1,19 @@ +FROM debian:buster-20210111-slim as builder +ARG DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH +RUN apt update -qq && apt upgrade -qqy && rm -rf /var/lib/apt/lists/* +ARG VERSION +RUN case $TARGETARCH in \ + arm) \ + wget https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-${VERSION}-armv6 -O /usr/bin/borg \ + ;; \ + arm64) \ + wget https://dl.bintray.com/borg-binary-builder/borg-binaries/borg-${VERSION}-arm64 -O /usr/bin/borg \ + ;; \ + amd64) \ + wget https://github.com/borgbackup/borg/releases/download/${VERSION}/borg-linux64 -O /usr/bin/borg \ + ;; \ + esac && \ + chmod a+x /usr/bin/borg +FROM debian:buster-20210111-slim +COPY --from=builder /usr/bin/borg /usr/bin/borg diff --git a/borg/Makefile b/borg/Makefile new file mode 100644 index 0000000..275c4a6 --- /dev/null +++ b/borg/Makefile @@ -0,0 +1,18 @@ +NAMESPACE=alemairebe +include version + +IMAGE=borg + +nopush: + docker buildx build --platform linux/amd64 --load \ + --build-arg VERSION=$(VERSION) \ + --tag ${NAMESPACE}/${IMAGE}:$(VERSION) \ + --tag ${CI_REGISTRY_IMAGE}/${IMAGE}:$(VERSION) . + +push: + docker buildx build --platform linux/amd64,linux/arm64,linux/arm --push \ + --build-arg VERSION=$(VERSION) \ + --cache-from=type=registry,ref=${NAMESPACE}/buildx:${IMAGE} \ + --cache-to=type=registry,ref=${NAMESPACE}/buildx:${IMAGE} \ + --tag ${NAMESPACE}/${IMAGE}:$(VERSION) \ + --tag ${CI_REGISTRY_IMAGE}/${IMAGE}:$(VERSION) . \ No newline at end of file diff --git a/borg/version b/borg/version new file mode 100644 index 0000000..18676ba --- /dev/null +++ b/borg/version @@ -0,0 +1 @@ +VERSION=1.1.15