Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: set correct version for runtime #7581

Merged
merged 4 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/docker-ort-runtime-ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

name: Mega Docker extended image
name: Docker extended runtime image

on:
workflow_dispatch:
Expand All @@ -24,14 +24,16 @@ on:
- '.versions'
- 'Dockerfile'
- 'Dockerfile-extended'
- '.github/workflows/docker-ort-runtime.yml'
- '.github/workflows/docker-ort-runtime-ext.yml'
push:
branches:
- main
tags:
- '*'
workflow_run:
workflows:
- 'Mega Docker runtime image'
- 'Docker runtime image'
types:
- completed

Expand Down Expand Up @@ -162,6 +164,13 @@ jobs:
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get ORT current 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 build
uses: docker/setup-buildx-action@v3
Expand All @@ -180,7 +189,9 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended
tags: |
type=raw,sha,enable=true,format=short
type=schedule,pattern={{date 'YYYYMMDD'}}
type=pep440,pattern={{version}}
type=raw,value=${{ env.ORT_VERSION }}

- name: Build ORT extended runtime image
uses: docker/build-push-action@v5
Expand All @@ -194,7 +205,7 @@ jobs:
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended:latest
labels: ${{ steps.meta.outputs.labels }}
build-contexts: |
ort=docker-image://${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:latest
ort=docker-image://${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:${{ env.ORT_VERSION }}
android=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/android:latest
swift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/swift:latest
scala=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/scala:latest
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/docker-ort-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

name: Mega Docker runtime image
name: Docker runtime image

on:
workflow_dispatch:
pull_request:
paths:
- '.versions'
- 'Dockerfile'
- '.github/workflows/docker-ort-runtime.yml'
push:
branches:
- main
Expand Down Expand Up @@ -172,11 +173,18 @@ jobs:
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV

- name: Get ORT current 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 build
uses: docker/setup-buildx-action@v3

Expand All @@ -194,7 +202,9 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort
tags: |
type=raw,sha,enable=true,format=short
type=schedule,pattern={{date 'YYYYMMDD'}}
type=pep440,pattern={{version}}
type=raw,value=${{ env.ORT_VERSION }}

- name: Build ORT runtime image
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
Expand All @@ -205,12 +215,13 @@ jobs:
push: true
load: false
build-args: |
NODEJS_VERSION=${{ env.NODEJS_VERSION }}
ORT_VERSION=${{ env.ORT_VERSION }}
tags: |
${{ steps.meta-ort.outputs.tags }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:latest
labels: ${{ steps.meta.outputs.labels }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest
nodejs=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/nodejs:latest
python=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/python:latest
rust=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/rust:latest
Expand Down
13 changes: 7 additions & 6 deletions scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
set -e -o pipefail

GIT_ROOT=$(git rev-parse --show-toplevel)
GIT_REVISION=$("$GIT_ROOT/gradlew" -q properties --property version | sed -nr "s/version: (.+)/\1/p")
ORT_VERSION=$("$GIT_ROOT/gradlew" -q properties --property version | sed -nr "s/version: (.+)/\1/p")
DOCKER_IMAGE_ROOT="${DOCKER_IMAGE_ROOT:-ghcr.io/oss-review-toolkit}"

echo "Setting ORT_VERSION to $GIT_REVISION."
echo "Setting ORT_VERSION to $ORT_VERSION."

# shellcheck disable=SC1091
. .versions
Expand Down Expand Up @@ -101,8 +101,8 @@ image_build golang ort/golang "$GO_VERSION" \
"$@"

# Runtime ORT image
image_build run ort "$GIT_REVISION" \
--build-arg NODEJS_VERSION="$NODEJS_VERSION" \
image_build run ort "$ORT_VERSION" \
--build-arg ORT_VERSION="$ORT_VERSION" \
--build-context "base=docker-image://${DOCKER_IMAGE_ROOT}/ort/base:latest" \
--build-context "python=docker-image://${DOCKER_IMAGE_ROOT}/ort/python:latest" \
--build-context "nodejs=docker-image://${DOCKER_IMAGE_ROOT}/ort/nodejs:latest" \
Expand Down Expand Up @@ -155,9 +155,10 @@ image_build haskell ort/haskell "$HASKELL_STACK_VERSION" \
# Runtime extended ORT image
docker buildx build \
--file Dockerfile-extended \
--tag "${DOCKER_IMAGE_ROOT}/ort-extended:$GIT_REVISION" \
--tag "${DOCKER_IMAGE_ROOT}/ort-extended:$ORT_VERSION" \
--tag "${DOCKER_IMAGE_ROOT}/ort-extended:latest" \
--build-context "ort=docker-image://${DOCKER_IMAGE_ROOT}/ort:latest" \
--build-arg ORT_VERSION="$ORT_VERSION" \
--build-context "ort=docker-image://${DOCKER_IMAGE_ROOT}/ort:${ORT_VERSION}" \
--build-context "sbt=docker-image://${DOCKER_IMAGE_ROOT}/ort/sbt:latest" \
--build-context "dotnet=docker-image://${DOCKER_IMAGE_ROOT}/ort/dotnet:latest" \
--build-context "swift=docker-image://${DOCKER_IMAGE_ROOT}/ort/swift:latest" \
Expand Down