Skip to content

Commit

Permalink
Build multi-arch image
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpeng committed Dec 14, 2022
1 parent 814ec35 commit b7ab0cb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 240 deletions.
74 changes: 50 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,95 @@
jobs:
build-branches-x86:
build-branches-amd64:
machine: true
steps:
- checkout
- run:
name: Build a container image
name: Build an amd64 container image
command: |
docker build -f Dockerfile.amd64 -t wise2c/kubeadm-version:$CIRCLE_BRANCH .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push wise2c/kubeadm-version:$CIRCLE_BRANCH
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:$CIRCLE_BRANCH kubeadm config images list
docker build -f Dockerfile.amd64 -t wise2c/kubeadm-version:amd64-$CIRCLE_BRANCH .
# docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# docker push wise2c/kubeadm-version:amd64-$CIRCLE_BRANCH
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:amd64-$CIRCLE_BRANCH kubeadm config images list
build-tags-x86:
machine: true
steps:
- checkout
- run:
name: Build a container image
name: Build an amd64 container image
command: |
docker build -f Dockerfile.amd64 -t wise2c/kubeadm-version:$CIRCLE_TAG .
docker build -f Dockerfile.amd64 -t wise2c/kubeadm-version:amd64-$CIRCLE_TAG .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push wise2c/kubeadm-version:$CIRCLE_TAG
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:$CIRCLE_TAG kubeadm config images list
docker push wise2c/kubeadm-version:amd64-$CIRCLE_TAG
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:amd64-$CIRCLE_TAG kubeadm config images list
build-branches-arm:
build-branches-aarch64:
machine: true
resource_class: arm.medium
steps:
- checkout
- run:
name: Build a container image
name: Build an aarch64 container image
command: |
docker build -f Dockerfile.aarch64 -t wise2c/kubeadm-version-arm:$CIRCLE_BRANCH .
docker build -f Dockerfile.aarch64 -t wise2c/kubeadm-version:aarch64-$CIRCLE_BRANCH .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push wise2c/kubeadm-version-arm:$CIRCLE_BRANCH
docker run --rm --name=kubeadm-version wise2c/kubeadm-version-arm:$CIRCLE_BRANCH kubeadm config images list
docker push wise2c/kubeadm-version:aarch64-$CIRCLE_BRANCH
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:aarch64-$CIRCLE_BRANCH kubeadm config images list
build-tags-arm:
build-tags-aarch64:
resource_class: arm.medium
machine: true
steps:
- checkout
- run:
name: Build a container image
name: Build an aarch64 container image
command: |
docker build -f Dockerfile.aarch64 -t wise2c/kubeadm-version:aarch64-$CIRCLE_TAG .
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push wise2c/kubeadm-version:aarch64-$CIRCLE_TAG
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:aarch64-$CIRCLE_TAG kubeadm config images list
build-branches-multi-arch:
machine: true
steps:
- run:
name: Build a multi-arch container image
command: |
docker build -f Dockerfile.aarch64 -t wise2c/kubeadm-version-arm:$CIRCLE_TAG .
docker manifest create wise2c/kubeadm-version:$CIRCLE_BRANCH wise2c/kubeadm-version:amd64-$CIRCLE_BRANCH wise2c/kubeadm-version:aarch64-$CIRCLE_BRANCH
docker manifest annotate wise2c/kubeadm-version:$CIRCLE_BRANCH wise2c/kubeadm-version:amd64-$CIRCLE_BRANCH --os linux --arch amd64
docker manifest annotate wise2c/kubeadm-version:$CIRCLE_BRANCH wise2c/kubeadm-version:aarch64-$CIRCLE_BRANCH --os linux --arch arm64
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push wise2c/kubeadm-version-arm:$CIRCLE_TAG
docker run --rm --name=kubeadm-version wise2c/kubeadm-version-arm:$CIRCLE_TAG kubeadm config images list
docker manifest push wise2c/kubeadm-version:$CIRCLE_BRANCH
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:$CIRCLE_BRANCH kubeadm config images list
build-tags-multi-arch:
machine: true
steps:
- run:
name: Build a multi-arch container image
command: |
docker manifest create wise2c/kubeadm-version:$CIRCLE_TAG wise2c/kubeadm-version:amd64-$CIRCLE_TAG wise2c/kubeadm-version:aarch64-$CIRCLE_TAG
docker manifest annotate wise2c/kubeadm-version:$CIRCLE_TAG wise2c/kubeadm-version:amd64-$CIRCLE_TAG --os linux --arch amd64
docker manifest annotate wise2c/kubeadm-version:$CIRCLE_TAG wise2c/kubeadm-version:aarch64-$CIRCLE_TAG --os linux --arch arm64
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker manifest push wise2c/kubeadm-version:$CIRCLE_TAG
docker run --rm --name=kubeadm-version wise2c/kubeadm-version:$CIRCLE_TAG kubeadm config images list
workflows:
version: 2
build-for-branches:
jobs:
- build-branches-x86
- build-branches-arm
- build-branches-amd64
- build-branches-aarch64
build-for-tags:
jobs:
- build-tags-x86:
- build-tags-amd64:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- build-tags-arm:
- build-tags-aarch64:
filters:
tags:
only: /^v.*/
Expand Down
24 changes: 0 additions & 24 deletions .gitlab-ci.yml

This file was deleted.

56 changes: 0 additions & 56 deletions build-images.sh

This file was deleted.

113 changes: 0 additions & 113 deletions gitlab-ci-template.yml

This file was deleted.

23 changes: 0 additions & 23 deletions kubeadm.conf.old

This file was deleted.

0 comments on commit b7ab0cb

Please sign in to comment.