Allow to configure the SBT version, and Java version / home #2006
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: Docker Build | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
env: | |
GRADLE_OPTS: -Dorg.gradle.daemon=false | |
REGISTRY: ghcr.io | |
jobs: | |
disk_space: | |
name: Docker Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Free Disk Space | |
uses: ./.github/actions/free-disk-space | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 | |
- name: Get ORT version | |
run: | | |
ORT_VERSION=$(./gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") | |
echo "ORT_VERSION=${ORT_VERSION}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Metadata for 'ort' Docker Image | |
id: meta-ort | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort | |
tags: | | |
type=pep440,pattern={{version}} | |
type=raw,value=${{ env.ORT_VERSION }} | |
type=ref,event=branch | |
type=ref,event=tag | |
type=sha | |
- name: Build & Push 'ort' Docker Image | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta-ort.outputs.tags }} | |
labels: ${{ steps.meta-ort.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache | |
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache,mode=max | |
build-args: ORT_VERSION=${{ env.ORT_VERSION }} | |
sbom: true | |
- name: Build 'ort' Docker Image | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 | |
with: | |
context: . | |
tags: ${{ steps.meta-ort.outputs.tags }} | |
labels: ${{ steps.meta-ort.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache | |
build-args: ORT_VERSION=${{ env.ORT_VERSION }} | |
sbom: true | |
- name: Extract Metadata for 'ort-minimal' Docker Image | |
id: meta-ort-minimal | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-minimal | |
tags: | | |
type=pep440,pattern={{version}} | |
type=raw,value=${{ env.ORT_VERSION }} | |
type=ref,event=branch | |
type=ref,event=tag | |
type=sha | |
- name: Build & Push 'ort-minimal' Docker Image | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 | |
with: | |
context: . | |
# Do not "cache-to" here to not overwrite additional layers from the "full" image, which also contains all | |
# layers present in the "minimal" image anyway. | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta-ort-minimal.outputs.tags }} | |
labels: ${{ steps.meta-ort-minimal.outputs.labels }} | |
target: minimal | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache | |
build-args: ORT_VERSION=${{ env.ORT_VERSION }} | |
sbom: true | |
- name: Print Disk Space | |
run: df -h |