Skip to content

Commit

Permalink
Introduced on CircleCI a multi-arch Docker image build using BuildX (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
azagniotov authored Jan 17, 2024
1 parent 50e41c3 commit 6f09ed9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,34 +262,34 @@ build_push_image_steps: &build_push_image_steps
- setup_remote_docker:
version: 20.10.11

# build the application image
- run:
name: Building Docker image
working_directory: ~/repo/docker/jdk<< parameters.jdk_version >>
# https://support.circleci.com/hc/en-us/articles/360058095471-How-To-Use-Docker-Buildx-in-Remote-Docker-
# https://microservices.io/post/microservices/2022/01/18/build-multi-arch-docker-images-circleci.html
name: Install cURL on Alpine Linux
command: |
echo "Creating a Docker context"
docker context create tls-environment
echo "BuildX creates and uses the Docker context"
docker buildx create tls-environment --use
echo "Starting Docker BuildX process .."
docker buildx build --platform linux/amd64,linux/arm64 --rm --no-cache -t azagniotov/stubby4j:latest-jre<< parameters.jdk_version >> .
echo ""
apk --no-cache add curl && curl --version
- run:
name: Install Docker Buildx
command: |
mkdir -vp ~/.docker/cli-plugins/
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.12.0/buildx-v0.12.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
docker buildx version
- run:
name: Authenticating to Docker Hub
command: |
echo "$DOCKER_HUB_PASSWORD" | docker login --username "$DOCKER_HUB_USER" --password-stdin
# deploy the image
- run:
name: Pushing Docker image to Docker Hub
name: Building and Pushing Multi Arch Docker images
working_directory: ~/repo/docker/jdk<< parameters.jdk_version >>
command: |
docker push azagniotov/stubby4j:latest-jre<< parameters.jdk_version >>
docker buildx rm buildx-build
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker context create tls-environment-jdk-<< parameters.jdk_version >>
docker buildx create tls-environment-jdk-<< parameters.jdk_version >> --use
docker buildx build --platform linux/arm64,linux/amd64 -f Dockerfile --rm --no-cache -t azagniotov/stubby4j:latest-jre<< parameters.jdk_version >> --push .
docker context rm tls-environment-jdk-<< parameters.jdk_version >>
smoke_test_steps: &smoke_test_steps
steps:
Expand Down Expand Up @@ -697,7 +697,7 @@ workflows:
master-twelve-hour-jdk8:
triggers:
- schedule:
cron: "10 7,19 * * *"
cron: "10 6,18 * * *"
<<: *filter_only_master
jobs:
- gradle_7_2_0_jdk8:
Expand Down Expand Up @@ -725,7 +725,7 @@ workflows:
master-twelve-hour-jdk16:
triggers:
- schedule:
cron: "20 7,19 * * *"
cron: "20 8,20 * * *"
<<: *filter_only_master
jobs:
- gradle_7_2_0_jdk16:
Expand Down
4 changes: 2 additions & 2 deletions docker/jdk11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk11-openj9@sha256:6c628ab1edc7b733b4880804fcd27dc360fc350f333546924e64e3a34a009fa2 AS BUILD_JAR_STAGE
FROM gradle:7.2.0-jdk11-openj9@sha256:68d2abb7a3dafef89b9f387095ebe2f7059dca48c53d83fd9328bf5914ce14a6 AS BUILD_JAR_STAGE

ARG REVISION=master
ENV GRADLE_USER_HOME=/home/gradle
Expand All @@ -27,7 +27,7 @@ RUN git clone https://github.com/azagniotov/stubby4j.git && \
# Stage 2 : create the Docker final image
########################################################################################
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:11.0.10-11.45.27-jre-headless@sha256:6cf54cbe8eef8a65eee89524dc9fcac4069425e87115ba908901f97c933703e8
FROM azul/zulu-openjdk-alpine:11.0.21-11.68-jre-headless@sha256:95750d3048415315d22effd433373f1ecd543be17fb658c650207db6c837ec09

ARG USER_ID=1001
ARG GROUP_ID=1001
Expand Down
4 changes: 2 additions & 2 deletions docker/jdk16/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk16-openj9@sha256:9620865af4f35026abfc9680603449296f832ea79da9a7f4e79d00989ccddcee AS BUILD_JAR_STAGE
FROM gradle:7.2.0-jdk17@sha256:e9e90cc97b29423dda5a2ff5ed7787a31ab7f43660bd83993a880e33e1504c7b AS BUILD_JAR_STAGE

ARG REVISION=master
ENV GRADLE_USER_HOME=/home/gradle
Expand All @@ -27,7 +27,7 @@ RUN git clone https://github.com/azagniotov/stubby4j.git && \
# Stage 2 : create the Docker final image
########################################################################################
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:16.0.2-16.32.15-jre@sha256:d323c348f27b9458ec88fd69947560314df0fe059ff7acb3055f96b28f466a4d
FROM azul/zulu-openjdk-alpine:17-jre@sha256:1d30a12d48c20c02dbcfe9e01c5a41878066c4ddaf1e5cd768ea87f2ba212973

ARG USER_ID=1001
ARG GROUP_ID=1001
Expand Down
4 changes: 2 additions & 2 deletions docker/jdk8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk8-openj9@sha256:d4128edf5ac579f93e3149a9f89be3af779de1d3d85a9f25f25cb3d4b432b69a AS BUILD_JAR_STAGE
FROM gradle:7.2.0-jdk8-openj9@sha256:18fdc03987ce333918cf2badfcb677d27ac1ca667b014eef32ba77b48e58ab83 AS BUILD_JAR_STAGE

ARG REVISION=master
ENV GRADLE_USER_HOME=/home/gradle
Expand All @@ -27,7 +27,7 @@ RUN git clone https://github.com/azagniotov/stubby4j.git && \
# Stage 2 : create the Docker final image
########################################################################################
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:8u282-8.52.0.23-jre-headless@sha256:91fe8ae651d5c778312e946e89f934240c2a80f55b7ca894d76daef8f5281375
FROM azul/zulu-openjdk-alpine:8u362-8.68.0.21-jre-arm64@sha256:460ae0fb1205fdca85d909d58a31c4691c9d52764391031e387854c48ba7c6d8

ARG USER_ID=1001
ARG GROUP_ID=1001
Expand Down

0 comments on commit 6f09ed9

Please sign in to comment.