File tree Expand file tree Collapse file tree 6 files changed +70
-0
lines changed
Expand file tree Collapse file tree 6 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 4646 # used to publish releases to GitHub by GoReleaser
4747 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
4848
49+ # used to publish docker images
50+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
51+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
52+
4953 # used in Azure tests
5054 KOPIA_AZURE_TEST_CONTAINER : ${{ secrets.KOPIA_AZURE_TEST_CONTAINER }}
5155 KOPIA_AZURE_TEST_STORAGE_ACCOUNT : ${{ secrets.KOPIA_AZURE_TEST_STORAGE_ACCOUNT }}
@@ -109,6 +113,12 @@ jobs:
109113 - name : Install macOS-specific packages
110114 run : " sudo xcode-select -r"
111115 if : ${{ contains(matrix.os, 'macos') }}
116+ - name : Set up QEMU
117+ uses : docker/setup-qemu-action@v1
118+ if : ${{ contains(matrix.os, 'ubuntu') }}
119+ - name : Set up Docker Buildx
120+ uses : docker/setup-buildx-action@v1
121+ if : ${{ contains(matrix.os, 'ubuntu') }}
112122 - name : Check out code into the Go module directory
113123 uses : actions/checkout@v2
114124 with :
Original file line number Diff line number Diff line change @@ -325,6 +325,8 @@ publish-packages:
325325ifeq ($(REPO_OWNER ) /$(GOOS ) /$(GOARCH ) /$(IS_PULL_REQUEST ) ,kopia/linux/amd64/false)
326326 $(CURDIR)/tools/apt-publish.sh $(CURDIR)/dist
327327 $(CURDIR)/tools/rpm-publish.sh $(CURDIR)/dist
328+ @echo $(DOCKERHUB_TOKEN) | docker login --username $(DOCKERHUB_USERNAME) --password-stdin
329+ $(CURDIR)/tools/docker-publish.sh
328330else
329331 @echo Not pushing to Linux repositories on pull request builds.
330332endif
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ DIST_DIR=dist
4+ DOCKER_BUILD_DIR=tools/docker
5+ DOCKERHUB_REPO=kopia/kopia
6+
7+ cp -r " $DIST_DIR /kopia_linux_amd64/" " $DOCKER_BUILD_DIR /bin-amd64/"
8+ cp -r " $DIST_DIR /kopia_linux_arm64/" " $DOCKER_BUILD_DIR /bin-arm64/"
9+ cp -r " $DIST_DIR /kopia_linux_arm_6/" " $DOCKER_BUILD_DIR /bin-arm/"
10+
11+ if [ " $KOPIA_VERSION_NO_PREFIX " == " " ]; then
12+ echo KOPIA_VERSION_NO_PREFIX not set, not publishing.
13+ exit 1
14+ fi
15+
16+ major=$( echo $KOPIA_VERSION_NO_PREFIX | cut -f 1 -d .)
17+ minor=$( echo $KOPIA_VERSION_NO_PREFIX | cut -f 2 -d .)
18+ rev=$( echo $KOPIA_VERSION_NO_PREFIX | cut -f 3 -d .)
19+
20+ # x.y.z
21+ if [[ " $KOPIA_VERSION_NO_PREFIX " =~ [0-9]+\. [0-9]+\. [0-9]+$ ]]; then
22+ extra_tags=" latest testing $major $major .$minor "
23+ fi
24+
25+ # x.y.z-prerelease
26+ if [[ " $KOPIA_VERSION_NO_PREFIX " =~ [0-9]+\. [0-9]+\. [0-9]+\- .* $ ]]; then
27+ extra_tags=" testing"
28+ fi
29+
30+ # yyyymmdd.0.hhmmss starts with 20
31+ if [[ " $KOPIA_VERSION_NO_PREFIX " =~ 20[0-9]+\. [0-9]+\. [0-9]+ ]]; then
32+ extra_tags=" unstable"
33+ fi
34+
35+ versioned_image=$DOCKERHUB_REPO :$KOPIA_VERSION_NO_PREFIX
36+ tags=" -t $versioned_image "
37+ for t in $extra_tags ; do
38+ if [ " $t " != " 0" ]; then
39+ tags=" $tags -t $DOCKERHUB_REPO :$t "
40+ fi
41+ done
42+
43+ echo Building $versioned_image with tags [$tags ]...
44+ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6 $tags --push $DOCKER_BUILD_DIR
Original file line number Diff line number Diff line change 1+ FROM alpine
2+ ARG TARGETARCH
3+ RUN apk add --no-cache --verbose ca-certificates && adduser -D kopia && addgroup kopia kopia
4+ USER kopia:kopia
5+ ENTRYPOINT ["/kopia" ]
6+ COPY bin-${TARGETARCH}/kopia /
Original file line number Diff line number Diff line change 1+ DOCKER_BUILD_DIR =.
2+
3+ make :
4+ cp -rv $(CURDIR ) /../dist/kopia_linux_amd64/ $(DOCKER_BUILD_DIR ) /bin-amd64
5+ cp -rv $(CURDIR ) /../dist/kopia_linux_arm64/ $(DOCKER_BUILD_DIR ) /bin-arm64
6+ cp -rv $(CURDIR ) /../dist/kopia_linux_arm_6/ $(DOCKER_BUILD_DIR ) /bin-arm
7+ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6 -t containers.jkowalski.net/kopia:latest --push $(DOCKER_BUILD_DIR )
Original file line number Diff line number Diff line change 1+ This is a directory for staging pre-built binaries from the ` dist/ ` directory to prevent sending the entire codebase to the docker daemon.
You can’t perform that action at this time.
0 commit comments