-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0be181b
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: | | ||
podman build -t binfmt . | ||
podman save --format oci-archive binfmt > binfmt.oci | ||
./unbase_oci -i include -l binfmt.oci binfmt.oci binfmt_distroless.oci | ||
image="$(podman load < binfmt_distroless.oci | awk '{ print $NF }')" | ||
podman tag "$image" "ghcr.io/${{ github.repository }}" | ||
podman login -u token -p "${{ github.token }}" ghcr.io | ||
podman push "ghcr.io/${{ github.repository }}" | ||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: podman run --privileged "ghcr.io/${{ github.repository }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM debian:testing | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends binfmt-support qemu-user-static | ||
CMD [ "dd", "bs=1M", "if=/usr/lib/binfmt.d/qemu-aarch64.conf", "of=/proc/sys/fs/binfmt_misc/register" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
usr/bin/dd | ||
usr/bin/qemu-aarch64-static | ||
usr/lib/binfmt.d/qemu-aarch64.conf | ||
usr/libexec/qemu-binfmt/aarch64-binfmt-P |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
container_image=ghcr.io/gardenlinux/unbase_oci:8c70d3ca5e9991ba50baeef84e9f2163d9223d93 | ||
container_engine=podman | ||
|
||
container_mount_opts=() | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--container-image) | ||
container_image="$2" | ||
shift 2 | ||
;; | ||
--container-engine) | ||
container_engine="$2" | ||
shift 2 | ||
;; | ||
--print-container-image) | ||
printf '%s\n' "$container_image" | ||
exit 0 | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
args=() | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
-i|--include|-x|--exclude|--dpkg-include) | ||
container_mount_opts+=(-v "$(realpath "$2"):/mnt$(realpath "$2")") | ||
args+=("$1" "/mnt$(realpath "$2")") | ||
shift 2 | ||
;; | ||
--no-default-include|--no-default-exclude|-d|--dpkg-dependencies|-l|--ldd-dependencies|--print-tree) | ||
args+=("$1") | ||
shift | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
container_mount_opts+=(-v "$(realpath "$1"):/mnt$(realpath "$1")") | ||
[ "$1" = "$2" ] || container_mount_opts+=(-v "$(realpath "$2"):/mnt$(realpath "$2")") | ||
[ -e "$3" ] || touch "$3" | ||
container_mount_opts+=(-v "$(realpath "$3"):/mnt$(realpath "$3")") | ||
args+=("/mnt$(realpath "$1")" "/mnt$(realpath "$2")" "/mnt$(realpath "$3")") | ||
|
||
"$container_engine" run --rm --read-only --tmpfs /tmp:rw,exec "${container_mount_opts[@]}" "$container_image" "${args[@]}" |