-
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.
Signed-off-by: Helio Chissini de Castro <heliocastro@gmail.com>
- Loading branch information
1 parent
a7e904e
commit d1bb930
Showing
5 changed files
with
113 additions
and
4 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,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 Docker Rust Container | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Ort Docker Base Image"] | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '.ortversions/rust.versions' | ||
- '.github/workflows/docker-ort-base.yml' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build: | ||
name: Build ORT Rust 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/rust.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 }}/rust | ||
tags: | | ||
type=raw,value=${{ env.RUST_VERSION }} | ||
- name: Build ORT Rust container | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
target: rust | ||
push: true | ||
load: false | ||
build-args: | | ||
RUST_VERSION=${{ env.RUST_VERSION }} | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/rust:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-contexts: | | ||
ort-base-image=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:latest | ||
cache-from: type=gha,scope=ortrust | ||
cache-to: type=gha,scope=ortrust,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 @@ | ||
RUST_VERSION=1.72.0 |
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
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
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,9 @@ | ||
# Rust | ||
ENV RUST_HOME=/opt/rust | ||
ENV CARGO_HOME=$RUST_HOME/cargo | ||
ENV RUSTUP_HOME=$RUST_HOME/rustup | ||
ENV PATH=$PATH:$CARGO_HOME/bin:$RUSTUP_HOME/bin | ||
COPY --from=ghcr.io/oss-review-toolkit/rust --chown=$USER:$USER $RUST_HOME $RUST_HOME | ||
RUN chmod o+rwx $CARGO_HOME | ||
|
||
RUN syft $RUST_HOME -o spdx-json --file /usr/share/doc/ort/ort-rust.spdx.json |