Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/actions/docker-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Build and optionally push a Docker image to Docker Hub and GitHub

inputs:
image_name:
description: 'Docker image name (e.g., sebffischer/anvil-cuda)'
description: 'Docker image name (e.g., sebffischer/anvl-cuda)'
required: true
dockerfile:
description: 'Path to the Dockerfile'
Expand All @@ -21,8 +21,8 @@ inputs:
ghcr_token:
description: 'GitHub token for GHCR (typically GITHUB_TOKEN)'
required: false
anvil_ref:
description: 'Git ref for r-xla/anvil to install (tag, branch, or SHA). Defaults to HEAD.'
anvl_ref:
description: 'Git ref for r-xla/anvl to install (tag, branch, or SHA). Defaults to HEAD.'
required: false
default: ''
no_cache:
Expand Down Expand Up @@ -102,7 +102,7 @@ runs:
build-args: |
BUILDKIT_INLINE_CACHE=1
CACHEBUST=${{ github.run_id }}
ANVIL_REF=${{ inputs.anvil_ref }}
ANVL_REF=${{ inputs.anvl_ref }}
secrets: ${{ inputs.github_pat != '' && format('github_pat={0}', inputs.github_pat) || '' }}
no-cache: ${{ inputs.no_cache == 'true' }}
cache-from: ${{ inputs.no_cache != 'true' && format('type=registry,ref=docker.io/{0}:buildcache', inputs.image_name) || '' }}
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ on:
- main

jobs:
resolve-anvil-release:
resolve-anvl-release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
changed: ${{ steps.set-changed.outputs.changed }}
steps:
- name: Get latest anvil release tag
- name: Get latest anvl release tag
id: get-tag
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh api repos/r-xla/anvil/releases/latest --jq '.tag_name')
tag=$(gh api repos/r-xla/anvl/releases/latest --jq '.tag_name')
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Latest anvil release: $tag"
echo "Latest anvl release: $tag"
- name: Check if release changed
id: check-cache
uses: actions/cache@v4
with:
path: /tmp/anvil-release-tag-cpu
key: anvil-release-cpu-${{ steps.get-tag.outputs.tag }}
path: /tmp/anvl-release-tag-cpu
key: anvl-release-cpu-${{ steps.get-tag.outputs.tag }}
- name: Set changed output
id: set-changed
run: |
if [ "${{ steps.check-cache.outputs.cache-hit }}" == "true" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
mkdir -p /tmp/anvil-release-tag-cpu
echo "${{ steps.get-tag.outputs.tag }}" > /tmp/anvil-release-tag-cpu/tag
mkdir -p /tmp/anvl-release-tag-cpu
echo "${{ steps.get-tag.outputs.tag }}" > /tmp/anvl-release-tag-cpu/tag
fi

build-latest:
Expand All @@ -53,20 +53,20 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
image_name: sebffischer/anvil-cpu
image_name: sebffischer/anvl-cpu
dockerfile: ./cpu/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
github_pat: ${{ secrets.GITHUB_TOKEN }}
extra_tags: |
docker.io/sebffischer/anvil-cpu:latest
ghcr.io/${{ github.repository_owner }}/anvil-cpu:latest
docker.io/sebffischer/anvl-cpu:latest
ghcr.io/${{ github.repository_owner }}/anvl-cpu:latest

build-release:
needs: resolve-anvil-release
if: needs.resolve-anvil-release.outputs.changed == 'true'
needs: resolve-anvl-release
if: needs.resolve-anvl-release.outputs.changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -75,14 +75,14 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
image_name: sebffischer/anvil-cpu
image_name: sebffischer/anvl-cpu
dockerfile: ./cpu/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
github_pat: ${{ secrets.GITHUB_TOKEN }}
anvil_ref: ${{ needs.resolve-anvil-release.outputs.tag }}
anvl_ref: ${{ needs.resolve-anvl-release.outputs.tag }}
extra_tags: |
docker.io/sebffischer/anvil-cpu:release
ghcr.io/${{ github.repository_owner }}/anvil-cpu:release
docker.io/sebffischer/anvl-cpu:release
ghcr.io/${{ github.repository_owner }}/anvl-cpu:release
44 changes: 22 additions & 22 deletions .github/workflows/cuda-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@ on:
- main

jobs:
resolve-anvil-release:
resolve-anvl-release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
changed: ${{ steps.set-changed.outputs.changed }}
steps:
- name: Get latest anvil release tag
- name: Get latest anvl release tag
id: get-tag
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh api repos/r-xla/anvil/releases/latest --jq '.tag_name')
tag=$(gh api repos/r-xla/anvl/releases/latest --jq '.tag_name')
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Latest anvil release: $tag"
echo "Latest anvl release: $tag"
- name: Check if release changed
id: check-cache
uses: actions/cache@v4
with:
path: /tmp/anvil-release-tag-cuda
key: anvil-release-cuda-${{ steps.get-tag.outputs.tag }}
path: /tmp/anvl-release-tag-cuda
key: anvl-release-cuda-${{ steps.get-tag.outputs.tag }}
- name: Set changed output
id: set-changed
run: |
if [ "${{ steps.check-cache.outputs.cache-hit }}" == "true" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
mkdir -p /tmp/anvil-release-tag-cuda
echo "${{ steps.get-tag.outputs.tag }}" > /tmp/anvil-release-tag-cuda/tag
mkdir -p /tmp/anvl-release-tag-cuda
echo "${{ steps.get-tag.outputs.tag }}" > /tmp/anvl-release-tag-cuda/tag
fi

# -- :latest builds (anvil main) --
# -- :latest builds (anvl main) --
build-cuda-base-latest:
runs-on: ubuntu-latest
permissions:
Expand All @@ -54,32 +54,32 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
image_name: sebffischer/anvil-cuda-base
image_name: sebffischer/anvl-cuda-base
dockerfile: ./cuda-base/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
no_cache: 'true'
extra_tags: |
docker.io/sebffischer/anvil-cuda-base:latest
ghcr.io/${{ github.repository_owner }}/anvil-cuda-base:latest
docker.io/sebffischer/anvl-cuda-base:latest
ghcr.io/${{ github.repository_owner }}/anvl-cuda-base:latest

build-cuda-latest:
needs: build-cuda-base-latest
uses: ./.github/workflows/cuda.yaml
with:
push: ${{ github.event_name != 'pull_request' }}
anvil_ref: ''
anvl_ref: ''
tag: latest
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

# -- :release builds (latest anvil release, only when release changed) --
# -- :release builds (latest anvl release, only when release changed) --
build-cuda-base-release:
needs: resolve-anvil-release
if: needs.resolve-anvil-release.outputs.changed == 'true'
needs: resolve-anvl-release
if: needs.resolve-anvl-release.outputs.changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -88,24 +88,24 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build
with:
image_name: sebffischer/anvil-cuda-base
image_name: sebffischer/anvl-cuda-base
dockerfile: ./cuda-base/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
no_cache: 'true'
extra_tags: |
docker.io/sebffischer/anvil-cuda-base:release
ghcr.io/${{ github.repository_owner }}/anvil-cuda-base:release
docker.io/sebffischer/anvl-cuda-base:release
ghcr.io/${{ github.repository_owner }}/anvl-cuda-base:release

build-cuda-release:
needs: [resolve-anvil-release, build-cuda-base-release]
if: needs.resolve-anvil-release.outputs.changed == 'true'
needs: [resolve-anvl-release, build-cuda-base-release]
if: needs.resolve-anvl-release.outputs.changed == 'true'
uses: ./.github/workflows/cuda.yaml
with:
push: ${{ github.event_name != 'pull_request' }}
anvil_ref: ${{ needs.resolve-anvil-release.outputs.tag }}
anvl_ref: ${{ needs.resolve-anvl-release.outputs.tag }}
tag: release
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
description: 'Whether to push the image'
type: boolean
default: false
anvil_ref:
description: 'Git ref for r-xla/anvil to install'
anvl_ref:
description: 'Git ref for r-xla/anvl to install'
type: string
default: ''
tag:
Expand All @@ -36,14 +36,14 @@ jobs:
- name: Build and push Docker image
uses: ./.github/actions/docker-build
with:
image_name: sebffischer/anvil-cuda
image_name: sebffischer/anvl-cuda
dockerfile: ./cuda/Dockerfile
push: ${{ inputs.push || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
github_pat: ${{ secrets.GITHUB_TOKEN }}
anvil_ref: ${{ inputs.anvil_ref }}
anvl_ref: ${{ inputs.anvl_ref }}
extra_tags: |
docker.io/sebffischer/anvil-cuda:${{ inputs.tag || 'latest' }}
ghcr.io/${{ github.repository_owner }}/anvil-cuda:${{ inputs.tag || 'latest' }}
docker.io/sebffischer/anvl-cuda:${{ inputs.tag || 'latest' }}
ghcr.io/${{ github.repository_owner }}/anvl-cuda:${{ inputs.tag || 'latest' }}
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Build variables (override with: make cpu TAG=mytag)
CPU_IMAGE_NAME ?= anvil-cpu
CUDA_BASE_IMAGE_NAME ?= anvil-cuda-base
CUDA_IMAGE_NAME ?= anvil-cuda
CPU_BENCH_IMAGE_NAME ?= anvil-cpu-bench
CUDA_BENCH_IMAGE_NAME ?= anvil-cuda-bench
CUDA_BENCH_12_4_IMAGE_NAME ?= anvil-cuda-bench-12.4
CPU_IMAGE_NAME ?= anvl-cpu
CUDA_BASE_IMAGE_NAME ?= anvl-cuda-base
CUDA_IMAGE_NAME ?= anvl-cuda
CPU_BENCH_IMAGE_NAME ?= anvl-cpu-bench
CUDA_BENCH_IMAGE_NAME ?= anvl-cuda-bench
CUDA_BENCH_12_4_IMAGE_NAME ?= anvl-cuda-bench-12.4
TAG ?= latest
PLATFORM ?= linux/amd64
PROGRESS ?= plain
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker images for anvil
# Docker images for anvl

This repository builds daily docker images for https://github.com/r-xla/anvil.
This repository builds daily docker images for https://github.com/r-xla/anvl.
Only amd64/x86-64 architecture is supported.

## Prebuilt Images
Expand All @@ -9,18 +9,18 @@ These images are built daily and pushed to [Docker Hub](https://hub.docker.com/u

| Image | Description |
|-------|-------------|
| `anvil-cpu` | Anvil with CPU support based on rocker/r-ver |
| `anvil-cuda-base` | Base image with CUDA 12.8.1 and all {anvil} system dependencies |
| `anvil-cuda` | `anvil-cuda-base` with {anvil} installed |
| `anvl-cpu` | Anvl with CPU support based on rocker/r-ver |
| `anvl-cuda-base` | Base image with CUDA 12.8.1 and all {anvl} system dependencies |
| `anvl-cuda` | `anvl-cuda-base` with {anvl} installed |

All images come with R installed.

Each image is available with two tags:

| Tag | Description |
|-----|-------------|
| `:latest` | Built from the anvil `main` branch (rebuilt daily and on push) |
| `:release` | Built from the latest anvil release (rebuilt when a new release is published) |
| `:latest` | Built from the anvl `main` branch (rebuilt daily and on push) |
| `:release` | Built from the latest anvl release (rebuilt when a new release is published) |

```bash
# From Docker Hub
Expand Down Expand Up @@ -49,8 +49,8 @@ These Dockerfiles are available for local builds but are not automatically built

| Image | Description |
|-------|-------------|
| `anvil-cpu-bench` | `anvil-cpu` + dependencies for benchmarking |
| `anvil-cuda-bench` | `anvil-cuda` + dependencies for benchmarking |
| `anvl-cpu-bench` | `anvl-cpu` + dependencies for benchmarking |
| `anvl-cuda-bench` | `anvl-cuda` + dependencies for benchmarking |

## Building Images Locally

Expand Down
2 changes: 1 addition & 1 deletion cpu-bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sebffischer/anvil-cpu:latest
FROM sebffischer/anvl-cpu:latest

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
10 changes: 5 additions & 5 deletions cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ COPY .Rprofile /usr/local/lib/R/etc/Rprofile.site

RUN R -q -e "install.packages('remotes', force = TRUE)"

# Cache bust to always reinstall anvil
# Cache bust to always reinstall anvl
ARG CACHEBUST=1
ARG ANVIL_REF=""
ARG ANVL_REF=""

# GITHUB_PAT is NOT part of the image
RUN --mount=type=secret,id=github_pat \
export GITHUB_PAT="$(cat /run/secrets/github_pat 2>/dev/null || true)" && \
ANVIL_REF="${ANVIL_REF:-HEAD}" \
R -q -e "remotes::install_github('r-xla/anvil', ref = Sys.getenv('ANVIL_REF'), force = TRUE)"
ANVL_REF="${ANVL_REF:-HEAD}" \
R -q -e "remotes::install_github('r-xla/anvl', ref = Sys.getenv('ANVL_REF'), force = TRUE)"

# Trigger PJRT plugin download
RUN R -q -e "anvil::nv_array(1, device = 'cpu')"
RUN R -q -e "anvl::nv_array(1, device = 'cpu')"

CMD ["bash"]
2 changes: 1 addition & 1 deletion cuda-bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sebffischer/anvil-cuda:latest
FROM sebffischer/anvl-cuda:latest

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
10 changes: 5 additions & 5 deletions cuda/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# -------- Build on cuda-base image --------
FROM sebffischer/anvil-cuda-base:latest
FROM sebffischer/anvl-cuda-base:latest

# -------- install R packages---------------------------
RUN R -q -e "install.packages('remotes', force = TRUE)"

# Cache bust to always reinstall anvil
# Cache bust to always reinstall anvl
ARG CACHEBUST=1
ARG ANVIL_REF=""
ARG ANVL_REF=""

# GITHUB_PAT is NOT part of the image
# USE_BUNDLED_LIBUV: fs >= 2.1.0 no longer auto-falls back to its bundled libuv
# when system libuv-dev is absent, so force the bundled build.
RUN --mount=type=secret,id=github_pat \
export GITHUB_PAT="$(cat /run/secrets/github_pat 2>/dev/null || true)" && \
ANVIL_REF="${ANVIL_REF:-HEAD}" \
ANVL_REF="${ANVL_REF:-HEAD}" \
USE_BUNDLED_LIBUV=1 \
R -q -e "remotes::install_github('r-xla/anvil', ref = Sys.getenv('ANVIL_REF'), force = TRUE)"
R -q -e "remotes::install_github('r-xla/anvl', ref = Sys.getenv('ANVL_REF'), force = TRUE)"

# Download PJRT plugins
# Can't use nv_array() here because it fails if no GPU is available
Expand Down
Loading