2019-02-13 03:35:27 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2019-02-20 03:45:55 +00:00
|
|
|
# Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS
|
|
|
|
# Publish jobs require those variables
|
|
|
|
publish_docker_linuxamd64:
|
|
|
|
machine:
|
2019-02-13 03:35:27 +00:00
|
|
|
docker_layer_caching: true
|
2019-02-20 03:45:55 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
command: |
|
2019-02-20 04:15:23 +00:00
|
|
|
LATEST_TAG="${CIRCLE_TAG:1}"
|
|
|
|
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-amd64"
|
|
|
|
DOCKERHUB_DOCKERFILE="Dockerfile"
|
2019-02-20 03:45:55 +00:00
|
|
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
2019-02-20 04:15:23 +00:00
|
|
|
sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" .
|
|
|
|
sudo docker push "$DOCKERHUB_DESTINATION"
|
2019-02-13 03:35:27 +00:00
|
|
|
|
2019-02-20 03:45:55 +00:00
|
|
|
publish_docker_linuxarm32v7:
|
2019-02-13 03:35:27 +00:00
|
|
|
machine:
|
|
|
|
docker_layer_caching: true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
command: |
|
2019-02-20 03:45:55 +00:00
|
|
|
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
2019-02-20 04:15:23 +00:00
|
|
|
LATEST_TAG="${CIRCLE_TAG:1}"
|
|
|
|
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm32v7"
|
2019-02-20 04:25:29 +00:00
|
|
|
DOCKERHUB_DOCKERFILE="Dockerfile"
|
2019-02-20 03:45:55 +00:00
|
|
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
2019-02-20 04:15:23 +00:00
|
|
|
sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" .
|
|
|
|
sudo docker push "$DOCKERHUB_DESTINATION"
|
2019-02-20 03:45:55 +00:00
|
|
|
|
|
|
|
publish_docker_multiarch:
|
|
|
|
machine:
|
|
|
|
enabled: true
|
|
|
|
image: circleci/classic:201808-01
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
# Turn on Experimental features
|
|
|
|
sudo mkdir $HOME/.docker
|
|
|
|
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json'
|
2019-02-13 03:35:27 +00:00
|
|
|
#
|
|
|
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
2019-02-20 03:45:55 +00:00
|
|
|
#
|
|
|
|
sudo docker manifest create --amend $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 $DOCKERHUB_REPO:latest-arm32v7
|
|
|
|
sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 --os linux --arch amd64
|
|
|
|
sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-arm32v7 --os linux --arch arm --variant v7
|
|
|
|
sudo docker manifest push $DOCKERHUB_REPO:latest -p
|
|
|
|
|
2019-02-13 03:35:27 +00:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
publish:
|
|
|
|
jobs:
|
2019-02-20 03:45:55 +00:00
|
|
|
- publish_docker_linuxamd64:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /v[0-9]+(\.[0-9]+)*/
|
|
|
|
- publish_docker_linuxarm32v7:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /v[0-9]+(\.[0-9]+)*/
|
|
|
|
- publish_docker_multiarch:
|
|
|
|
requires:
|
|
|
|
- publish_docker_linuxamd64
|
|
|
|
- publish_docker_linuxarm32v7
|
2019-02-13 03:35:27 +00:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
2019-02-13 22:50:40 +00:00
|
|
|
only: /v[0-9]+(\.[0-9]+)*/
|