Skip to content

Commit

Permalink
chore: use reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
deowk committed May 6, 2024
1 parent 8d4a759 commit 16f9c96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 35 deletions.
44 changes: 10 additions & 34 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
# - name: Publish coverage metrics to Coveralls.io
# run: mvn -B -f xyz.balzaclang.balzac.lib/ jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }}

docker-build:
get-war-file:
runs-on: ubuntu-latest
name: Build multi-arch docker images
needs: [build]
Expand All @@ -91,37 +91,13 @@ jobs:
uses: actions/download-artifact@v3
with:
name: war-artifact

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ vars.REGISTRY }}/${{ vars.REPOSITORY }}
tags: |
type=raw,value=latest,enable=${{ inputs.latestTag || false }}
type=raw,value=test,enable=${{ inputs.testTag || false }}
type=raw,value=test-{{sha}},enable=${{ inputs.testTag || false }}
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' }}
- name: Build Docker images
uses: docker/build-push-action@v5

docker-build:
name: Build multi-arch docker images
needs: [get-war-file]
uses: aiblockofficial/workflows/.github/workflows/build-multi-platform.yml@main
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.ref_type == 'tag' }}
build-args: war=balzac.war
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
REGISTRY: ${{ vars.REGISTRY }}
REPOSITORY: ${{ vars.REPOSITORY }}
BUILD_ARGS: |
war=balzac.war
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ RUN cd balzac && mvn -f xyz.balzaclang.balzac.parent/ clean package && mv xyz.ba

# Set up tomcat to run the compiled war
FROM cgr.dev/chainguard/tomcat:latest
ENV WAR_FILE=balzac.war
ARG WAR_FILE_ARG=balzac.war
ENV WAR_FILE=WAR_FILE_ARG

EXPOSE 8080
HEALTHCHECK CMD curl --fail http://localhost:8080/balzac/version || exit 1
Expand Down

0 comments on commit 16f9c96

Please sign in to comment.