Skip to content

Docker Next Generation - Per language container strategy #36

Docker Next Generation - Per language container strategy

Docker Next Generation - Per language container strategy #36

# Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE
name: Runtime Image
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
workflow_run:
workflows:
- 'Python Image'
- 'NodeJS Image'
- 'Ruby Image'
- 'Rust Image'
- 'Golang Image'
types:
- completed
env:
REGISTRY: ghcr.io
permissions: write-all
jobs:
build:
name: Build ORT runtime Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout default branch
uses: actions/checkout@v3
- name: Set environment variables
run: |
cat .ortversions/nodejs.versions >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract components metadata (tags, labels) for Ort runtime image
id: meta-ort
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort
tags: |
type=raw,sha,enable=true,format=short
- name: Build ORT runtime container
uses: docker/build-push-action@v4
with:
context: .
target: run
push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
load: false
build-args: |
NODEJS_VERSION=${{ env.NODEJS_VERSION }}
tags: |
${{ steps.meta-ort.outputs.tags }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:latest
labels: ${{ steps.meta.outputs.labels }}
build-contexts: |
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
ruby=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/ruby:latest
golang=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/golang:latest