Skip to content

Docker Nightly Builder #1974

Docker Nightly Builder

Docker Nightly Builder #1974

---
name: Docker Nightly Builder
"on":
push:
branches:
- trunk
pull_request:
branches:
- trunk
schedule:
- cron: "0 0 * * *" # build nightly!
jobs:
nightly:
name: Nightly
runs-on: ubuntu-latest
strategy:
matrix:
build:
- alpine
- debian
- ubuntu
include:
- build: alpine
target_triple: x86_64-unknown-linux-musl
dockerfile: alpine/Dockerfile
docker_target_platforms: linux/amd64
tag_bare: alpine
tag_version: alpine3
- build: debian
target_triple: x86_64-unknown-linux-gnu
dockerfile: debian/bookworm/slim/Dockerfile
docker_target_platforms: linux/amd64,linux/arm64
tag_bare: slim
tag_version: slim-bookworm
- build: ubuntu
target_triple: x86_64-unknown-linux-gnu
dockerfile: ubuntu/jammy/Dockerfile
docker_target_platforms: linux/amd64,linux/arm64
tag_bare: ubuntu
tag_version: ubuntu-jammy
steps:
- uses: actions/[email protected]
- name: Clone Artichoke
uses: actions/[email protected]
with:
repository: artichoke/artichoke
path: artichoke
- name: Set Artichoke latest commit
id: latest
working-directory: artichoke
run: |
echo "Artichoke git ref: $(git rev-parse HEAD)"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.11"
- name: Set Artichoke Rust toolchain version
id: rust_toolchain
working-directory: artichoke
shell: python
run: |
import os
import tomllib
with open("rust-toolchain.toml", "rb") as f:
data = tomllib.load(f)
toolchain = data["toolchain"]["channel"]
print(f"Rust toolchain version: {toolchain}")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"version={toolchain}", file=f)
- name: Set labels
id: labels
working-directory: artichoke
shell: python
run: |
import datetime
import os
import tomllib
with open("Cargo.toml", "rb") as f:
data = tomllib.load(f)
version = data["package"]["version"]
version = f"{version}-nightly"
print(f"Artichoke version: {version}")
current_time = datetime.datetime.now(datetime.timezone.utc)
build_timestamp = current_time.isoformat()
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"artichoke_version={version}", file=f)
print(f"build_timestamp={build_timestamp}", file=f)
- name: Generate THIRDPARTY license listing
uses: artichoke/[email protected]
with:
artichoke_ref: ${{ steps.latest.outputs.commit }}
target_triple: ${{ matrix.target_triple }}
output_file: ${{ github.workspace }}/THIRDPARTY
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
if: github.ref == 'refs/heads/trunk'
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
context: .
platforms: ${{ matrix.docker_target_platforms }}
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/trunk' }}
tags: |
artichokeruby/artichoke:${{ matrix.tag_bare }}-nightly
artichokeruby/artichoke:${{ matrix.tag_version }}-nightly
build-args: |
ARTICHOKE_NIGHTLY_REVISION=${{ steps.latest.outputs.commit }}
ARTICHOKE_NIGHTLY_VERSION=${{ steps.labels.outputs.artichoke_version }}
BUILD_TIMESTAMP=${{ steps.labels.outputs.build_timestamp }}
RUST_VERSION=${{ steps.rust_toolchain.outputs.version }}
- name: Build and push Docker images (Ubuntu extra tags)
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
if: matrix.build == 'ubuntu'
with:
context: .
platforms: ${{ matrix.docker_target_platforms }}
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/trunk' }}
tags: |
artichokeruby/artichoke:latest
artichokeruby/artichoke:ubuntu22.04-nightly
build-args: |
ARTICHOKE_NIGHTLY_REVISION=${{ steps.latest.outputs.commit }}
ARTICHOKE_NIGHTLY_VERSION=${{ steps.labels.outputs.artichoke_version }}
BUILD_TIMESTAMP=${{ steps.labels.outputs.build_timestamp }}
RUST_VERSION=${{ steps.rust_toolchain.outputs.version }}