Merge branch 'master' into github-actions-docker

This commit is contained in:
ShahanaFarooqui 2024-06-24 22:26:53 -07:00 committed by GitHub
commit f5f27d6c71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,102 +1,59 @@
version: 2
version: 2.1
executors:
docker-executor:
docker:
- image: circleci/python:3.8
jobs:
# Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS
# Publish jobs require those variables
publish_docker_linuxamd64:
machine:
docker_layer_caching: false
setup-docker-buildx:
executor: docker-executor
steps:
- checkout
- setup_remote_docker:
version: 20.10.7
experimental: true
- run:
name: Set up QEMU
command: |
LATEST_TAG="${CIRCLE_TAG:1}"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-amd64"
DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile"
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" .
sudo docker push "$DOCKERHUB_DESTINATION"
no_output_timeout: 25m
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- run:
name: Set up Buildx
command: |
docker buildx create --use
docker buildx inspect --bootstrap
publish_docker_linuxarm32v7:
machine:
docker_layer_caching: false
publish_docker:
executor: docker-executor
steps:
- checkout
- setup_remote_docker:
version: 20.10.7
experimental: true
- checkout
- run:
name: Set up QEMU
command: |
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
LATEST_TAG="${CIRCLE_TAG:1}"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm32v7"
DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile.arm32v7"
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" .
sudo docker push "$DOCKERHUB_DESTINATION"
no_output_timeout: 25m
publish_docker_linuxarm64v8:
machine:
docker_layer_caching: false
steps:
- checkout
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- run:
name: Set up Buildx
command: |
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
LATEST_TAG="${CIRCLE_TAG:1}"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm64v8"
DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile.arm64v8"
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" .
sudo docker push "$DOCKERHUB_DESTINATION"
no_output_timeout: 25m
publish_docker_multiarch:
machine:
enabled: true
image: ubuntu-2004:2022.07.1
steps:
docker buildx create --use
docker buildx inspect --bootstrap
- run:
name: Build and push Docker images
command: |
# Turn on Experimental features
LATEST_TAG="${CIRCLE_TAG:1}"
sudo mkdir ./.docker
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> ./.docker/config.json'
#
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
#
sudo docker manifest create --amend "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-amd64" "$DOCKERHUB_REPO:$LATEST_TAG-arm32v7" "$DOCKERHUB_REPO:$LATEST_TAG-arm64v8"
sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-amd64" --os linux --arch amd64
sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-arm32v7" --os linux --arch arm --variant v7
sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-arm64v8" --os linux --arch arm64 --variant v8
sudo docker manifest push "$DOCKERHUB_REPO:$LATEST_TAG" -p
no_output_timeout: 25m
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG"
docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --pull -t "$DOCKERHUB_DESTINATION" -f dockerfiles/Dockerfile --push .
workflows:
version: 2
publish:
jobs:
- publish_docker_linuxamd64:
filters:
branches:
ignore: /.*/
tags:
only: /v(?:(?<major>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<minor>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<patch>(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/
- publish_docker_linuxarm32v7:
filters:
branches:
ignore: /.*/
tags:
only: /v(?:(?<major>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<minor>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<patch>(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/
- publish_docker_linuxarm64v8:
filters:
branches:
ignore: /.*/
tags:
only: /v(?:(?<major>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<minor>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<patch>(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/
- publish_docker_multiarch:
- setup-docker-buildx
- publish_docker:
requires:
- publish_docker_linuxamd64
- publish_docker_linuxarm32v7
- publish_docker_linuxarm64v8
- setup-docker-buildx
filters:
branches:
ignore: /.*/