2021-04-02 13:59:47 +02:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
jobs:
|
2021-07-01 08:18:04 +02:00
|
|
|
canary:
|
2021-07-09 08:14:35 +02:00
|
|
|
machine:
|
2022-02-15 21:05:03 +01:00
|
|
|
image: ubuntu-2004:202201-02
|
2021-04-02 13:59:47 +02:00
|
|
|
working_directory: ~/docker-volume-backup
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Build
|
2021-07-01 08:18:04 +02:00
|
|
|
command: |
|
|
|
|
docker build . -t offen/docker-volume-backup:canary
|
2021-08-23 09:08:50 +02:00
|
|
|
- run:
|
|
|
|
name: Install gnupg
|
|
|
|
command: |
|
|
|
|
sudo apt-get install -y gnupg
|
2021-04-02 13:59:47 +02:00
|
|
|
- run:
|
2021-07-09 08:14:35 +02:00
|
|
|
name: Run tests
|
2021-07-11 13:27:01 +02:00
|
|
|
working_directory: ~/docker-volume-backup/test
|
2021-04-02 13:59:47 +02:00
|
|
|
command: |
|
2022-02-15 21:05:03 +01:00
|
|
|
export GPG_TTY=$(tty)
|
2021-07-11 20:21:17 +02:00
|
|
|
./test.sh canary
|
2021-07-01 08:18:04 +02:00
|
|
|
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
- image: cimg/base:2020.06
|
|
|
|
environment:
|
|
|
|
DOCKER_BUILDKIT: '1'
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
|
|
working_directory: ~/docker-volume-backup
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker:
|
|
|
|
version: 20.10.6
|
2021-04-02 13:59:47 +02:00
|
|
|
- docker/install-docker-credential-helper
|
|
|
|
- docker/configure-docker-credentials-store
|
|
|
|
- run:
|
|
|
|
name: Push to Docker Hub
|
|
|
|
command: |
|
|
|
|
echo "$DOCKER_ACCESSTOKEN" | docker login --username offen --password-stdin
|
2021-07-01 08:18:04 +02:00
|
|
|
# This is required for building ARM: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12406
|
|
|
|
docker run --rm --privileged linuxkit/binfmt:v0.8
|
|
|
|
docker context create docker-volume-backup
|
|
|
|
docker buildx create docker-volume-backup --name docker-volume-backup --use
|
|
|
|
docker buildx inspect --bootstrap
|
2021-08-22 20:16:24 +02:00
|
|
|
tag_args="-t offen/docker-volume-backup:$CIRCLE_TAG"
|
|
|
|
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
# prerelease tags like `v2.0.0-alpha.1` should not be released as `latest`
|
|
|
|
tag_args="$tag_args -t offen/docker-volume-backup:latest"
|
2022-03-25 18:27:00 +01:00
|
|
|
tag_args="$tag_args -t offen/docker-volume-backup:$(echo "$CIRCLE_TAG" | cut -d. -f1)"
|
2021-08-22 20:16:24 +02:00
|
|
|
fi
|
2021-07-01 15:16:39 +02:00
|
|
|
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
2021-08-22 20:16:24 +02:00
|
|
|
$tag_args . --push
|
2021-04-02 13:59:47 +02:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2021-07-01 08:18:04 +02:00
|
|
|
docker_image:
|
2021-04-02 13:59:47 +02:00
|
|
|
jobs:
|
2021-07-01 08:18:04 +02:00
|
|
|
- canary:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
ignore: /^v.*/
|
2021-04-02 14:23:59 +02:00
|
|
|
- build:
|
|
|
|
filters:
|
2021-07-01 08:18:04 +02:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
2021-04-02 14:23:59 +02:00
|
|
|
tags:
|
|
|
|
only: /^v.*/
|
2021-04-02 13:59:47 +02:00
|
|
|
|
|
|
|
orbs:
|
|
|
|
docker: circleci/docker@1.0.1
|