Skip to content

Build image manually #29

Build image manually

Build image manually #29

Workflow file for this run

name: Build image manually
on:
workflow_dispatch:
inputs:
docker_image_tag_name:
type: string
description: Docker image tag name (Optional)
jobs:
prepare-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
outputs:
tag_name: ${{ steps.prepare_tag.outputs.tag_name }}
build-image:
needs: prepare-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Build
run: |
./mvnw clean install -B -DskipTests -P exec-jar
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/canner/wren-engine
tags: |
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Prepare
id: prepare
run: |
WREN_VERSION=$(./mvnw --quiet help:evaluate -Dexpression=project.version -DforceStdout)
cp ./wren-server/target/wren-server-${WREN_VERSION}-executable.jar ./docker
echo "WREN_VERSION=$WREN_VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./docker
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
build-args: |
WREN_VERSION=${{ steps.prepare.outputs.WREN_VERSION }}
push: true
build-ibis-image:
needs: prepare-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/canner/wren-engine-ibis
tags: |
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./ibis-server
build-contexts: |
wren-modeling-py=./wren-modeling-py
wren-modeling-rs=./wren-modeling-rs
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}