-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): Use per language container strategy
Ort language components are built now in independent containers. This enables the possibility to create custom tailored containers with only the required language components, reducing final size and improving build process. Default runtime now contains Pytho, NodeJs, Rust, Ruby and Golang components. Other language components have their own containers built, and can be included on custom images. Signed-off-by: Helio Chissini de Castro <[email protected]>
- Loading branch information
1 parent
af1cbfc
commit efac549
Showing
38 changed files
with
1,986 additions
and
141 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 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: Ort Docker Android Container | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
paths: | ||
- '.ortversions/android.versions' | ||
- '.github/workflows/docker-ort-base.yml' | ||
workflow_run: | ||
workflows: ["Ort Docker Base Image"] | ||
types: | ||
- completed | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
name: Build ORT Android Image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout main repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set environment variables | ||
run: | | ||
cat .ortversions/android.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 base image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository }}/android | ||
tags: | | ||
type=semver,pattern={{version}},value=${{ env.ANDROID_CMD_VERSION }} | ||
- name: Build ORT Android container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: android | ||
push: true | ||
load: false | ||
build-args: | | ||
ANDROID_CMD_VERSION=${{ env.ANDROID_CMD_VERSION }} | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/android:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-contexts: | | ||
ort-base-image=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest | ||
cache-from: type=gha,scope=ortandroid | ||
cache-to: type=gha,scope=ortandroid,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# 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: Ort Docker Base Container | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
paths: | ||
- 'Dockerfile' | ||
- '.ortversions/base.versions' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build: | ||
name: Build ORT Base image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout main repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set environment variables | ||
run: | | ||
cat .ortversions/base.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 base image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository }}/base | ||
tags: | ||
type=raw,value=${{ env.JAVA_VERSION }}-jdk-${{ env.UBUNTU_VERSION }} | ||
|
||
- name: Build ORT Base container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: ort-base-image | ||
push: true | ||
load: false | ||
build-args: | | ||
JAVA_VERSION=${{ env.JAVA_VERSION }} | ||
UBUNTU_VERSION=${{ env.UBUNTU_VERSION }} | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/base:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha,scope=ortbase | ||
cache-to: type=gha,scope=ortbase,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 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: Ort Binaries Container | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: ["Ort Docker Base Image"] | ||
types: | ||
- completed | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
name: Build ORT Binary Image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout main repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- 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 base image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository }}/ortbin | ||
tags: | | ||
type=raw,sha,enable=true,format=short | ||
- name: Build ORT ort container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: ort | ||
push: true | ||
load: false | ||
build-args: | | ||
ORT_VERSION=${{ env.ORT_VERSION }} | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/ortbin:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-contexts: | | ||
ort-base-image=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest | ||
cache-from: type=gha,scope=ortort | ||
cache-to: type=gha,scope=ortort,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 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: Ort Docker Dart Container | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
paths: | ||
- '.ortversions/dart.versions' | ||
- '.github/workflows/docker-ort-base.yml' | ||
workflow_run: | ||
workflows: ["Ort Docker Base Image"] | ||
types: | ||
- completed | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
name: Build ORT Dart Image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout main repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set environment variables | ||
run: | | ||
cat .ortversions/dart.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 base image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository }}/dart | ||
tags: | | ||
type=semver,pattern={{version}},value=${{ env.DART_VERSION }} | ||
- name: Build ORT Dart container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: dart | ||
push: ${{ github.event_name == 'push' }} | ||
load: false | ||
build-args: | | ||
DART_VERSION=${{ env.DART_VERSION }} | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/dart:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-contexts: | | ||
ort-base-image=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest | ||
cache-from: type=gha,scope=ortdart | ||
cache-to: type=gha,scope=ortdart,mode=max |
Oops, something went wrong.