Skip to content

Commit aead9ca

Browse files
committed
1.0.0
1 parent b7c2f78 commit aead9ca

File tree

4 files changed

+130
-1
lines changed

4 files changed

+130
-1
lines changed

.github/workflows/regular.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build OCI Image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-22.04
11+
container:
12+
image: catthehacker/ubuntu:act-22.04
13+
env:
14+
DOCKER_CONFIG: '~/.docker/'
15+
steps:
16+
- name: buildx setup
17+
uses: docker/setup-buildx-action@v3
18+
with:
19+
use: true
20+
platforms: linux/amd64,linux/arm64
21+
- name: oci metadata
22+
id: meta
23+
uses: docker/metadata-action@v5
24+
with:
25+
images: |
26+
ghcr.io/${{ github.repository }}
27+
tags: |
28+
type=sha,event=branch
29+
labels: |
30+
org.opencontainers.image.description=A buildkit runner
31+
- name: oci build
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: "{{defaultContext}}"
35+
platforms: linux/arm64,linux/amd64
36+
build-args: BUILDKIT_TAG=v0.15.1
37+
push: false
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build OCI Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
# Permissions to be given to the GITHUB_TOKEN for this workflow
9+
permissions:
10+
packages: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-22.04
15+
container:
16+
image: catthehacker/ubuntu:act-22.04
17+
env:
18+
DOCKER_CONFIG: '~/.docker/'
19+
steps:
20+
- name: buildx setup
21+
uses: docker/setup-buildx-action@v3
22+
with:
23+
use: true
24+
platforms: linux/amd64,linux/arm64
25+
- name: oci metadata
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: |
30+
ghcr.io/${{ github.repository }}
31+
tags: |
32+
type=semver,pattern={{version}}
33+
type=semver,pattern={{major}}.{{minor}}
34+
labels: |
35+
org.opencontainers.image.description=A buildkit runner
36+
- name: oci login
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.repository_owner }}
41+
# Use the built-in GitHub action token for authentication with ghcr
42+
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
- name: oci build
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: "{{defaultContext}}"
48+
platforms: linux/arm64,linux/amd64
49+
build-args: BUILDKIT_TAG=v0.15.1
50+
# Only push package if triggered by tag and prevent anyone from creating tags using tag-protection for this repository
51+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules
52+
push: ${{ github.ref_type == 'tag' }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ghcr.io/catthehacker/ubuntu:act-22.04 AS build
2+
# injected by build-push-action by default
3+
ARG TARGETARCH
4+
# injected by build-push-action build-args
5+
ARG BUILDKIT_TAG
6+
RUN echo "TARGETARCH=${TARGETARCH}"
7+
RUN echo "BUILDKIT_TAG=${BUILDKIT_TAG}"
8+
RUN wget -q "https://github.com/moby/buildkit/releases/download/${BUILDKIT_TAG}/buildkit-${BUILDKIT_TAG}.linux-${TARGETARCH}.tar.gz"
9+
RUN mkdir /buildkit && cat buildkit-${BUILDKIT_TAG}.linux-${TARGETARCH}.tar.gz | tar -C /buildkit -zxvf -
10+
# cleanup layers
11+
# PersistentVolume privilege missmatch between act-runner and workflow pod currently stop us from using the less privileged runner variant
12+
#FROM ghcr.io/catthehacker/ubuntu:runner-22.04
13+
FROM ghcr.io/catthehacker/ubuntu:act-22.04
14+
LABEL org.opencontainers.image.title act-buildkit-runner
15+
LABEL org.opencontainers.image.description A Ubuntu based act runner with integrated buildkit
16+
LABEL org.opencontainers.image.licenses MIT
17+
COPY --from=build /buildkit/bin/buildctl /usr/bin/buildctl

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# act-buildkit-runner
1+
# Act BuildKit Runner
2+
3+
A [`act`](https://github.com/nektos/act) runner based on [`catthehacker/ubuntu:act-22.04`](https://github.com/catthehacker/docker_images) with integrated [buildkit](https://github.com/moby/buildkit). Foundation for [buildkit-build-push-action](https://github.com/omniproc/buildkit-build-push-action).
4+
5+
6+
# Example usage
7+
8+
```yaml
9+
name: Example
10+
on:
11+
push
12+
jobs:
13+
test:
14+
runs-on: ubuntu-22.04
15+
container:
16+
image: ghcr.io/omniproc/act-buildkit-runner:0.1.1
17+
steps:
18+
- name: git checkout
19+
uses: https://github.com/actions/checkout@v4
20+
```

0 commit comments

Comments
 (0)