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: jobs:
# Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS setup-docker-buildx:
# Publish jobs require those variables executor: docker-executor
publish_docker_linuxamd64:
machine:
docker_layer_caching: false
steps: steps:
- setup_remote_docker:
version: 20.10.7
experimental: true
- run:
name: Set up QEMU
command: |
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:
executor: docker-executor
steps:
- setup_remote_docker:
version: 20.10.7
experimental: true
- checkout - checkout
- run: - run:
name: Set up QEMU
command: | command: |
LATEST_TAG="${CIRCLE_TAG:1}" docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
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
publish_docker_linuxarm32v7:
machine:
docker_layer_caching: false
steps:
- checkout
- run: - run:
name: Set up Buildx
command: | command: |
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset docker buildx create --use
LATEST_TAG="${CIRCLE_TAG:1}" docker buildx inspect --bootstrap
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
- run: - run:
name: Build and push Docker images
command: | command: |
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
LATEST_TAG="${CIRCLE_TAG:1}" LATEST_TAG="${CIRCLE_TAG:1}"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm64v8" DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG"
DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile.arm64v8" docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo 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 .
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:
- run:
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
workflows: workflows:
version: 2 version: 2
publish: publish:
jobs: jobs:
- publish_docker_linuxamd64: - setup-docker-buildx
filters: - publish_docker:
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:
requires: requires:
- publish_docker_linuxamd64 - setup-docker-buildx
- publish_docker_linuxarm32v7
- publish_docker_linuxarm64v8
filters: filters:
branches: branches:
ignore: /.*/ ignore: /.*/