Skip to content

Commit

Permalink
build: attempt to create both adm64 and arm64 docker files
Browse files Browse the repository at this point in the history
Switched from RedHat to Azul JDK images.
  • Loading branch information
novoj committed Dec 26, 2023
1 parent 2acee05 commit 0ac5938
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/docker-canary.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This job builds and deploys Docker image to DockerHub

name: DockerHub-deploy
name: DockerHub-deploy-canary

on:
workflow_run:
Expand All @@ -13,7 +13,8 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3 # checkout from Git
- name: Checkout
uses: actions/checkout@v4 # checkout from Git

- name: Download a single artifact # download `evita-server.jar` artifact if the workflow we react to was successful
uses: dawidd6/action-download-artifact@v2
Expand All @@ -22,6 +23,17 @@ jobs:
workflow_conclusion: success
name: evita-server.jar

- name: Set up QEMU
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
platforms: linux/amd64,linux/arm64/v8

- name: Build the Docker image # now build the Docker image, login to DockerHub and push it, then clean everything
env:
BUILD_ROOT: docker
Expand All @@ -34,9 +46,12 @@ jobs:
run: |
echo "Evita JAR name: $EVITA_JAR_NAME"
echo "Build root: $BUILD_ROOT"
mv -v "$EVITA_JAR_NAME" "$BUILD_ROOT/$EVITA_JAR_NAME"
ls -la $BUILD_ROOT
$BUILD_ROOT/build.sh
mv -v "$EVITA_JAR_NAME" "$BUILD_ROOT/$EVITA_JAR_NAME"
cd $BUILD_ROOT
ls -la .
EVITA_JAR_NAME="$EVITA_JAR_NAME"
echo "Tagging as: $CI_REGISTRY_USER/$RELEASE_IMAGE"
docker buildx . --pull -t "$CI_REGISTRY_USER/$RELEASE_IMAGE" --build-arg "EVITA_JAR_NAME=$EVITA_JAR_NAME"
echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
echo "Pushing image: $CI_REGISTRY_IMAGE/$CI_REGISTRY_USER/$RELEASE_IMAGE"
docker push "$CI_REGISTRY_IMAGE/$CI_REGISTRY_USER/$RELEASE_IMAGE"
Expand Down
9 changes: 1 addition & 8 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,13 @@ else
fi

echo "Tagging as: $IMAGE"
docker build . \
docker buildx . \
--pull \
--platform linux/amd64 \
-t "$IMAGE" \
\
--build-arg "EVITA_JAR_NAME=$EVITA_JAR_NAME"

docker build . \
--pull \
--platform linux/arm64/v8 \
-t "$IMAGE" \
\
--build-arg "EVITA_JAR_NAME=$EVITA_JAR_NAME"

if [ "$1" = "local" ] || [ "$1" = "performance" ]; then
rm evita-server.jar
fi

0 comments on commit 0ac5938

Please sign in to comment.