From 5a49f2f063e887cba85bba0347ebce3efe15753e Mon Sep 17 00:00:00 2001 From: Gareth Date: Mon, 19 Feb 2024 12:24:44 -0800 Subject: [PATCH] feat: add rclone binary to docker image and arm64 support (#105) --- .github/workflows/build-and-test.yml | 5 ++++- .github/workflows/release.yml | 3 +++ .goreleaser.yaml | 26 ++++++++++++++++++++++++-- Dockerfile | 8 ++------ Dockerfile.example | 8 -------- 5 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 Dockerfile.example diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 50319b91..37ad9931 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -16,6 +16,9 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Go uses: actions/setup-go@v4 with: @@ -31,7 +34,7 @@ jobs: with: distribution: goreleaser version: latest - args: build --snapshot --clean + args: release --snapshot --clean - name: Test run: PATH=$(pwd):$PATH go test ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 10d42c6a..30a42ce7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,9 @@ jobs: with: fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Go uses: actions/setup-go@v4 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 94f51784..65c201b3 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -52,8 +52,30 @@ archives: dockers: - image_templates: - - garethgeorge/backrest:latest - - garethgeorge/backrest:{{ .Tag }} + - garethgeorge/backrest:{{ .Tag }}-amd64 + dockerfile: Dockerfile + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/amd64" + + - image_templates: + - garethgeorge/backrest:{{ .Tag }}-arm64 + goarch: arm64 + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/arm64/v8" + +docker_manifests: + - name_template: "garethgeorge/backrest:latest" + image_templates: + - "garethgeorge/backrest:{{ .Tag }}-amd64" + - "garethgeorge/backrest:{{ .Tag }}-arm64" + - name_template: "garethgeorge/backrest:{{ .Tag }}" + image_templates: + - "garethgeorge/backrest:{{ .Tag }}-amd64" + - "garethgeorge/backrest:{{ .Tag }}-arm64" changelog: sort: asc diff --git a/Dockerfile b/Dockerfile index 7b68f0a5..5c7583e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,9 @@ -FROM golang:alpine as gobuild -RUN mkdir /tmp-orig -COPY backrest /backrest - FROM rclone/rclone:1.65 as rclone FROM alpine:latest -COPY --from=gobuild /tmp-orig /tmp COPY --from=rclone /usr/local/bin/rclone /usr/local/bin/rclone -RUN apk --no-cache add ca-certificates bash curl +RUN apk --no-cache add ca-certificates curl bash +RUN mkdir -p /tmp ENTRYPOINT ["/backrest"] COPY backrest /backrest \ No newline at end of file diff --git a/Dockerfile.example b/Dockerfile.example deleted file mode 100644 index 7a566ed1..00000000 --- a/Dockerfile.example +++ /dev/null @@ -1,8 +0,0 @@ -FROM garethgeorge/backrest:latest AS backrest -FROM ubuntu:14.04 AS ubuntu -COPY --from=backrest /tmp /tmp -COPY --from=backrest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=backrest /backrest /backrest -# install custom binaries for use with backrest hooks -RUN apt-get update && apt-get install -y curl bash -ENTRYPOINT ["/backrest"]