Skip to content

Commit

Permalink
feat: Built separate docker images for ARM and x86
Browse files Browse the repository at this point in the history
Closes #249
  • Loading branch information
devatherock committed Jun 3, 2023
1 parent c3db550 commit ef56caa
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
75 changes: 52 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ executors:
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
resource_class: medium
<<: *resource_class
<<: *work_directory
environment:
# To generate swagger UI
Expand All @@ -50,6 +50,10 @@ executors:
<<: *docker_executor_image
resource_class: medium
<<: *work_directory
machine-executor:
machine:
image: ubuntu-2204:2023.04.2
resource_class: medium

version: 2.1
jobs:
Expand Down Expand Up @@ -77,6 +81,7 @@ jobs:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
<<: *work_directory
<<: *resource_class
steps:
- checkout
- run: sh /scripts/entry-point.sh
Expand Down Expand Up @@ -118,39 +123,41 @@ jobs:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}

integration_test:
machine:
image: ubuntu-2004:202010-01
publish:
executor: native-image-executor
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: ~/artifactory-badge
- run: |
make integration-test remote-integration-test
- store_test_results:
path: build/test-results

publish:
executor: native-image-executor
TAG=${CIRCLE_SHA1:0:8}
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker build \
-t devatherock/artifactory-badge:$TAG \
-t devatherock/artifactory-badge:latest \
-t devatherock/artifactory-badge:amd64 .
docker image push --all-tags devatherock/artifactory-badge
publish_arm:
machine:
image: ubuntu-2004:2022.04.1
resource_class: arm.medium
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: ~/artifactory-badge
- run: |
TAG=${CIRCLE_SHA1:0:8}
TAG=${CIRCLE_SHA1:0:8}-arm64
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx create --name rockbuilder \
--driver docker-container --use --bootstrap
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
docker build \
-t devatherock/artifactory-badge:$TAG \
-t devatherock/artifactory-badge:latest .
-t devatherock/artifactory-badge:arm64 .
docker image push --all-tags devatherock/artifactory-badge
dockerhub_readme:
machine:
image: ubuntu-2204:2023.04.2
executor: machine-executor
steps:
- checkout
- run: |
Expand All @@ -161,6 +168,17 @@ jobs:
-e SHORT_DESCRIPTION='Badge generator for docker registries hosted in jfrog artifactory' \
-e README_FILEPATH='/workspace/README.md' \
peterevans/dockerhub-description:3.4.1
integration_test:
executor: machine-executor
steps:
- checkout
- attach_workspace:
at: ~/artifactory-badge
- run: |
make integration-test remote-integration-test
- store_test_results:
path: build/test-results

publish_release:
executor: docker-executor
Expand All @@ -173,10 +191,14 @@ jobs:
TAG=${CIRCLE_TAG#v}
DEV_TAG=${CIRCLE_SHA1:0:8}
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx create --name rockbuilder \
--driver docker-container --use --bootstrap
docker buildx imagetools create \
-t devatherock/artifactory-badge:$TAG devatherock/artifactory-badge:$DEV_TAG
docker pull devatherock/artifactory-badge:$DEV_TAG
docker tag devatherock/artifactory-badge:$DEV_TAG devatherock/artifactory-badge:$TAG
docker tag devatherock/artifactory-badge:$DEV_TAG devatherock/artifactory-badge:${TAG}-amd64
docker pull devatherock/artifactory-badge:${DEV_TAG}-arm64
docker tag devatherock/artifactory-badge:${DEV_TAG}-arm64 devatherock/artifactory-badge:${TAG}-arm64
docker push devatherock/artifactory-badge:$TAG
docker push devatherock/artifactory-badge:${TAG}-amd64
docker push devatherock/artifactory-badge:${TAG}-arm64
notify:
<<: *slack_image
Expand Down Expand Up @@ -209,6 +231,11 @@ workflows:
- docker-credentials
requires:
- build
- publish_arm:
context:
- docker-credentials
requires:
- build
- dockerhub_readme:
context:
- docker-credentials
Expand All @@ -226,6 +253,8 @@ workflows:
- slack-webhook
requires:
- integration_test
- publish_arm

release:
jobs:
- publish_release:
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
- Updated dockerhub readme in CI pipeline
- fix(deps): update dependency org.projectlombok:lombok to v1.18.28
- chore(deps): update plugin com.diffplug.spotless to v6.19.0
- chore(deps): update plugin org.sonarqube to v4.1.0.3113
- [#247](https://github.com/devatherock/artifactory-badge/issues/247): Built a multi-arch docker image
- chore(deps): update plugin org.sonarqube to v4.2.0.3129
- [#249](https://github.com/devatherock/artifactory-badge/issues/249): Built separate docker images for ARM and x86

### Removed
- `Jansi` as it was preventing the app from running in local
Expand Down

0 comments on commit ef56caa

Please sign in to comment.