Reduce size by using base images #123
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: Build Ink Cross Images | |
on: | |
push: | |
branches: [ main ] | |
paths: [ .github/workflows/ink-cross.yml, cmake/**, docker/**, scripts/**, build-args.sh ] | |
pull_request: | |
branches: [ main ] | |
paths: [ .github/workflows/ink-cross.yml, cmake/**, docker/**, scripts/**, build-args.sh ] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * 6' | |
permissions: { } | |
jobs: | |
ink-cross: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: aarch64-unknown-freebsd | |
platforms: linux/amd64,linux/arm64 | |
nightly-only: true | |
- target: aarch64-unknown-linux-gnu | |
platforms: linux/amd64,linux/arm64 | |
- target: aarch64-unknown-linux-musl | |
platforms: linux/amd64,linux/arm64 | |
- target: armv7-unknown-linux-gnueabihf | |
platforms: linux/amd64,linux/arm64 | |
- target: armv7-unknown-linux-musleabihf | |
platforms: linux/amd64,linux/arm64 | |
- target: powerpc64-unknown-linux-gnu | |
platforms: linux/amd64 | |
- target: powerpc64le-unknown-linux-gnu | |
platforms: linux/amd64,linux/arm64 | |
- target: riscv64gc-unknown-linux-gnu | |
platforms: linux/amd64,linux/arm64 | |
- target: s390x-unknown-linux-gnu | |
platforms: linux/amd64,linux/arm64 | |
- target: sparc64-unknown-linux-gnu | |
platforms: linux/amd64 | |
- target: x86_64-unknown-freebsd | |
platforms: linux/amd64,linux/arm64 | |
- target: x86_64-unknown-linux-gnu | |
platforms: linux/amd64,linux/arm64 | |
- target: x86_64-unknown-linux-musl | |
platforms: linux/amd64,linux/arm64 | |
- target: x86_64-unknown-netbsd | |
platforms: linux/amd64,linux/arm64 | |
- target: x86_64-unknown-openbsd | |
platforms: linux/amd64,linux/arm64 | |
nightly-only: true | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:master | |
- name: Docker Setup Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Login | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Login | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Vars | |
run: | | |
echo "BUILD_DATE=$(date --utc)" >> "$GITHUB_ENV" | |
./build-args.sh | |
- name: Vars (Latest Rust Pinned) | |
if: ${{ matrix.nightly-only == '' }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: echo "LATEST_RUST_VERSION=$(gh release view -R rust-lang/rust --json tagName --jq '.tagName')" >> "$GITHUB_ENV" | |
- name: Vars (Latest Openssl) | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: echo "OPENSSL_VERSION=$(gh release view -R openssl/openssl --json tagName --jq '.tagName')" >> "$GITHUB_ENV" | |
- name: Build and push Docker images (pinned) | |
if: ${{ matrix.nightly-only == '' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./docker/${{ matrix.target }}.Dockerfile | |
no-cache: true | |
cache-to: type=inline | |
pull: true | |
push: ${{ github.event_name != 'pull_request' }} | |
provenance: mode=max | |
sbom: true | |
tags: ghcr.io/cargo-prebuilt/ink-cross:${{ env.LATEST_RUST_VERSION }}-${{ matrix.target }},quay.io/cargo-prebuilt/ink-cross:${{ env.LATEST_RUST_VERSION }}-${{ matrix.target }} | |
build-args: | | |
RUST_VERSION=${{ env.LATEST_RUST_VERSION }} | |
CMAKE_VERSION=${{ env.CMAKE_VERSION }} | |
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }} | |
LLVM_VERSION=${{ env.LLVM_VERSION }} | |
MUSL_VERSION=${{ env.MUSL_VERSION }} | |
FREEBSD_MAJOR=${{ env.FREEBSD_MAJOR }} | |
NETBSD_MAJOR=${{ env.NETBSD_MAJOR }} | |
OPENBSD_MAJOR=${{ env.OPENBSD_MAJOR }} | |
labels: | | |
tech.harmless.ink-cross.target="${{ matrix.target }}" | |
tech.harmless.ink-cross.pull_request_build="${{ github.event_name == 'pull_request' }}" | |
tech.harmless.ink-cross.run_number="${{ github.run_number }}" | |
tech.harmless.ink-cross.repo="${{ github.repositoryUrl }}" | |
tech.harmless.ink-cross.build_date="${{ env.BUILD_DATE }}" | |
tech.harmless.ink-cross.version.rust="${{ env.LATEST_RUST_VERSION }}" | |
tech.harmless.ink-cross.version.cmake="${{ env.CMAKE_VERSION }}" | |
tech.harmless.ink-cross.version.openssl="${{ env.OPENSSL_VERSION }}" | |
tech.harmless.ink-cross.version.llvm="${{ env.LLVM_VERSION }}" | |
org.opencontainers.image.authors="harmless-tech, cargo-prebuilt" | |
org.opencontainers.image.source = "${{ github.server_url }}/${{ github.repository }}" | |
platforms: ${{ matrix.platforms }} | |
builder: ${{ steps.buildx.outputs.name }} | |
- name: Build and push Docker images (stable) | |
if: ${{ matrix.nightly-only == '' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./docker/${{ matrix.target }}.Dockerfile | |
cache-from: type=inline | |
pull: true | |
push: ${{ github.event_name != 'pull_request' }} | |
provenance: mode=max | |
sbom: true | |
tags: ghcr.io/cargo-prebuilt/ink-cross:stable-${{ matrix.target }},quay.io/cargo-prebuilt/ink-cross:stable-${{ matrix.target }} | |
build-args: | | |
RUST_VERSION=stable | |
RUSTUP_VERSION=${{ env.RUSTUP_VERSION }} | |
CMAKE_VERSION=${{ env.CMAKE_VERSION }} | |
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }} | |
LLVM_VERSION=${{ env.LLVM_VERSION }} | |
MUSL_VERSION=${{ env.MUSL_VERSION }} | |
FREEBSD_MAJOR=${{ env.FREEBSD_MAJOR }} | |
NETBSD_MAJOR=${{ env.NETBSD_MAJOR }} | |
OPENBSD_MAJOR=${{ env.OPENBSD_MAJOR }} | |
labels: | | |
tech.harmless.ink-cross.target="${{ matrix.target }}" | |
tech.harmless.ink-cross.pull_request_build="${{ github.event_name == 'pull_request' }}" | |
tech.harmless.ink-cross.run_number="${{ github.run_number }}" | |
tech.harmless.ink-cross.repo="${{ github.repositoryUrl }}" | |
tech.harmless.ink-cross.build_date="${{ env.BUILD_DATE }}" | |
tech.harmless.ink-cross.version.rust="stable" | |
tech.harmless.ink-cross.version.rustup="${{ env.RUSTUP_VERSION }}" | |
tech.harmless.ink-cross.version.cmake="${{ env.CMAKE_VERSION }}" | |
tech.harmless.ink-cross.version.openssl="${{ env.OPENSSL_VERSION }}" | |
tech.harmless.ink-cross.version.llvm="${{ env.LLVM_VERSION }}" | |
org.opencontainers.image.authors="harmless-tech, cargo-prebuilt" | |
org.opencontainers.image.source = "${{ github.server_url }}/${{ github.repository }}" | |
platforms: ${{ matrix.platforms }} | |
builder: ${{ steps.buildx.outputs.name }} | |
- name: Build and push Docker images (beta) | |
if: ${{ matrix.nightly-only == '' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./docker/${{ matrix.target }}.Dockerfile | |
cache-from: type=inline | |
pull: true | |
push: ${{ github.event_name != 'pull_request' }} | |
provenance: mode=max | |
sbom: true | |
tags: ghcr.io/cargo-prebuilt/ink-cross:beta-${{ matrix.target }},quay.io/cargo-prebuilt/ink-cross:beta-${{ matrix.target }} | |
build-args: | | |
RUST_VERSION=beta | |
RUSTUP_VERSION=${{ env.RUSTUP_VERSION }} | |
CMAKE_VERSION=${{ env.CMAKE_VERSION }} | |
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }} | |
LLVM_VERSION=${{ env.LLVM_VERSION }} | |
MUSL_VERSION=${{ env.MUSL_VERSION }} | |
FREEBSD_MAJOR=${{ env.FREEBSD_MAJOR }} | |
NETBSD_MAJOR=${{ env.NETBSD_MAJOR }} | |
OPENBSD_MAJOR=${{ env.OPENBSD_MAJOR }} | |
labels: | | |
tech.harmless.ink-cross.target="${{ matrix.target }}" | |
tech.harmless.ink-cross.pull_request_build="${{ github.event_name == 'pull_request' }}" | |
tech.harmless.ink-cross.run_number="${{ github.run_number }}" | |
tech.harmless.ink-cross.repo="${{ github.repositoryUrl }}" | |
tech.harmless.ink-cross.build_date="${{ env.BUILD_DATE }}" | |
tech.harmless.ink-cross.version.rust="beta" | |
tech.harmless.ink-cross.version.rustup="${{ env.RUSTUP_VERSION }}" | |
tech.harmless.ink-cross.version.cmake="${{ env.CMAKE_VERSION }}" | |
tech.harmless.ink-cross.version.openssl="${{ env.OPENSSL_VERSION }}" | |
tech.harmless.ink-cross.version.llvm="${{ env.LLVM_VERSION }}" | |
org.opencontainers.image.authors="harmless-tech, cargo-prebuilt" | |
org.opencontainers.image.source = "${{ github.server_url }}/${{ github.repository }}" | |
platforms: ${{ matrix.platforms }} | |
builder: ${{ steps.buildx.outputs.name }} | |
- name: Build and push Docker images (nightly) | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./docker/${{ matrix.target }}.Dockerfile | |
cache-from: type=inline | |
pull: true | |
push: ${{ github.event_name != 'pull_request' }} | |
provenance: mode=max | |
sbom: true | |
tags: ghcr.io/cargo-prebuilt/ink-cross:nightly-${{ matrix.target }},quay.io/cargo-prebuilt/ink-cross:nightly-${{ matrix.target }} | |
build-args: | | |
RUST_VERSION=nightly | |
RUSTUP_VERSION=${{ env.RUSTUP_VERSION }} | |
CMAKE_VERSION=${{ env.CMAKE_VERSION }} | |
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }} | |
LLVM_VERSION=${{ env.LLVM_VERSION }} | |
MUSL_VERSION=${{ env.MUSL_VERSION }} | |
FREEBSD_MAJOR=${{ env.FREEBSD_MAJOR }} | |
NETBSD_MAJOR=${{ env.NETBSD_MAJOR }} | |
OPENBSD_MAJOR=${{ env.OPENBSD_MAJOR }} | |
labels: | | |
tech.harmless.ink-cross.target="${{ matrix.target }}" | |
tech.harmless.ink-cross.pull_request_build="${{ github.event_name == 'pull_request' }}" | |
tech.harmless.ink-cross.run_number="${{ github.run_number }}" | |
tech.harmless.ink-cross.repo="${{ github.repositoryUrl }}" | |
tech.harmless.ink-cross.build_date="${{ env.BUILD_DATE }}" | |
tech.harmless.ink-cross.version.rust="nightly" | |
tech.harmless.ink-cross.version.rustup="${{ env.RUSTUP_VERSION }}" | |
tech.harmless.ink-cross.version.cmake="${{ env.CMAKE_VERSION }}" | |
tech.harmless.ink-cross.version.openssl="${{ env.OPENSSL_VERSION }}" | |
tech.harmless.ink-cross.version.llvm="${{ env.LLVM_VERSION }}" | |
org.opencontainers.image.authors="harmless-tech, cargo-prebuilt" | |
org.opencontainers.image.source = "${{ github.server_url }}/${{ github.repository }}" | |
platforms: ${{ matrix.platforms }} | |
builder: ${{ steps.buildx.outputs.name }} |