Build image #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build image | |
on: | |
workflow_dispatch: | |
inputs: | |
docker_image_tag_name: | |
type: string | |
description: Docker image tag name (Optional) | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
cache: 'maven' | |
- name: Build | |
run: | | |
./mvnw clean install -B -DskipTests -P exec-jar | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Prepare tag name | |
id: prepare_tag | |
run: | | |
if [ -n "${{ github.event.inputs.docker_image_tag_name }}" ]; then | |
tag_name=${{ github.event.inputs.docker_image_tag_name }} | |
else | |
tag_name=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9]/-/g')-$(git log -1 --pretty=%h) | |
fi | |
echo ::set-output name=tag_name::$tag_name | |
- name: Build Docker image | |
run: | | |
WREN_VERSION=$(./mvnw --quiet help:evaluate -Dexpression=project.version -DforceStdout) | |
cd ./docker | |
cp ../wren-server/target/wren-server-${WREN_VERSION}-executable.jar ./ | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64 \ | |
--tag ghcr.io/canner/wren-engine:${{ steps.prepare_tag.outputs.tag_name }} \ | |
--push -f ./Dockerfile \ | |
--build-arg "WREN_VERSION=${WREN_VERSION}" . |