Skip to content

Commit c257ab5

Browse files
authored
Merge pull request #4 from the-void-ia/feature/oci
OCI Support
2 parents fcd17f1 + bcab4e3 commit c257ab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5988
-106
lines changed

.github/workflows/guest-image.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Guest Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build-guest:
14+
name: Build Guest (${{ matrix.arch }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
arch: [x86_64, aarch64]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
with:
26+
targets: ${{ matrix.arch }}-unknown-linux-musl
27+
28+
- name: Install dependencies
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y musl-tools cpio gzip xz-utils zstd
32+
33+
- name: Install aarch64 cross-compiler
34+
if: matrix.arch == 'aarch64'
35+
run: |
36+
sudo apt-get install -y gcc-aarch64-linux-gnu
37+
38+
- name: Build initramfs
39+
run: |
40+
ARCH=${{ matrix.arch }} OUT_CPIO=/tmp/rootfs.cpio.gz \
41+
scripts/build_guest_image.sh
42+
43+
- name: Download kernel
44+
run: |
45+
ARCH=${{ matrix.arch }} scripts/download_kernel.sh
46+
47+
- name: Prepare artifacts
48+
run: |
49+
mkdir -p artifacts
50+
cp /tmp/rootfs.cpio.gz artifacts/rootfs.cpio.gz
51+
case "${{ matrix.arch }}" in
52+
x86_64) cp target/vmlinuz-amd64 artifacts/vmlinuz ;;
53+
aarch64) cp target/vmlinuz-arm64 artifacts/vmlinuz ;;
54+
esac
55+
56+
- name: Upload artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: guest-${{ matrix.arch }}
60+
path: artifacts/
61+
62+
push-image:
63+
name: Push Multi-Arch Image
64+
needs: build-guest
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Download x86_64 artifacts
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: guest-x86_64
74+
path: staging/amd64/
75+
76+
- name: Download aarch64 artifacts
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: guest-aarch64
80+
path: staging/arm64/
81+
82+
- name: Set up Docker Buildx
83+
uses: docker/setup-buildx-action@v3
84+
85+
- name: Log in to GHCR
86+
uses: docker/login-action@v3
87+
with:
88+
registry: ghcr.io
89+
username: ${{ github.actor }}
90+
password: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: Extract tag
93+
id: tag
94+
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
95+
96+
- name: Create Dockerfile
97+
run: |
98+
cat > staging/Dockerfile <<'EOF'
99+
FROM scratch
100+
ARG TARGETARCH
101+
COPY ${TARGETARCH}/vmlinuz /vmlinuz
102+
COPY ${TARGETARCH}/rootfs.cpio.gz /rootfs.cpio.gz
103+
EOF
104+
105+
- name: Build and push
106+
uses: docker/build-push-action@v6
107+
with:
108+
context: staging
109+
file: staging/Dockerfile
110+
platforms: linux/amd64,linux/arm64
111+
push: true
112+
tags: |
113+
ghcr.io/the-void-ia/voidbox-guest:${{ steps.tag.outputs.version }}
114+
ghcr.io/the-void-ia/voidbox-guest:latest

0 commit comments

Comments
 (0)