Skip to content

Commit

Permalink
Build executor images
Browse files Browse the repository at this point in the history
  • Loading branch information
sansmoraxz committed Aug 10, 2023
1 parent 4c3f38e commit 0a87fff
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build-executors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build executors

on:
push:

env:
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}

defaults:
run:
working-directory: ./executors

jobs:
generate-build-matrices:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: |
executors
- name: List executors
id: list-executors
run: |-
echo "executors=$(ls \
| awk -F/ '{print tolower($1)}' \
| jq -R -s -c 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
outputs:
executors: ${{ steps.list-executors.outputs.executors }}

build:
needs: ['generate-build-matrices']
permissions:
contents: read
packages: write
id-token: write

name: Build executors
runs-on: ubuntu-latest
strategy:
matrix:
executor: ${{ fromJson(needs.generate-build-matrices.outputs.executors) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: |
executors
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/executor-${{ matrix.executor }}

- name: Build and push
id: build-and-push
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
file: Dockerfile.gpu
cache-to: type=gha,mode=min

0 comments on commit 0a87fff

Please sign in to comment.