Skip to content
Closed
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
89 changes: 89 additions & 0 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
name: 'Build container'

on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- container/**
push:
branches:
- master
paths:
- container/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: classabbyamp/treeless-checkout-action@v1

- name: Get image release
id: release
run: |
# gets the list of all date-shaped tags for the image, finds the most recent one
tag="$(skopeo list-tags "docker://ghcr.io/${{ github.repository_owner }}/void-mklive" | \
jq -r '.Tags | sort | reverse | map(select(test("^[0-9]{8}(R[0-9]+)?$")))[0]')"
# tags from a different day or pre-YYYYMMDDRN
if [ "${tag%R*}" != "$(date -u +%Y%m%d)" ] || [ "${tag%R*}" = "${tag}" ]; then
rel=1
else
rel=$(( ${tag##*R} + 1 ))
fi
echo "rel=${rel}" >> "${GITHUB_OUTPUT}"

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/void-mklive
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{date 'YYYYMMDD'}}R${{ steps.release.outputs.rel }},enable={{is_default_branch}},priority=1000
flavor: latest=false
labels: |
org.opencontainers.image.authors=Void Linux team and contributors
org.opencontainers.image.url=https://voidlinux.org
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=Void Linux
org.opencontainers.image.title=Void Linux mklive container
org.opencontainers.image.description=Image for building mklive images

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GCHR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
id: build_and_push
uses: docker/bake-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
targets: void-mklive
files: |
container/docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
set: |
_common.cache-to=type=gha
_common.cache-from=type=gha
59 changes: 15 additions & 44 deletions .github/workflows/gen-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
flavor: ${{ fromJson(needs.prepare.outputs.live_flavors) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
image: 'ghcr.io/void-linux/void-mklive:20250116R1'
options: --privileged
volumes:
- /dev:/dev
Expand All @@ -121,13 +121,8 @@ jobs:
steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
run: xbps-install -Syu xbps && xbps-install -yu

- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand Down Expand Up @@ -160,7 +155,7 @@ jobs:
arch: ${{ fromJson(needs.prepare.outputs.rootfs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
image: 'ghcr.io/void-linux/void-mklive:20250116R1'
options: --privileged
volumes:
- /dev:/dev
Expand All @@ -171,13 +166,8 @@ jobs:
steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
run: xbps-install -Syu xbps && xbps-install -yu

- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand Down Expand Up @@ -210,7 +200,7 @@ jobs:
platform: ${{ fromJson(needs.prepare.outputs.platformfs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
image: 'ghcr.io/void-linux/void-mklive:20250116R1'
options: --privileged
volumes:
- /dev:/dev
Expand All @@ -221,13 +211,8 @@ jobs:
steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
run: xbps-install -Syu xbps && xbps-install -yu

- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand Down Expand Up @@ -261,7 +246,7 @@ jobs:
platform: ${{ fromJson(needs.prepare.outputs.sbc_imgs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
image: 'ghcr.io/void-linux/void-mklive:20250116R1'
options: --privileged
volumes:
- /dev:/dev
Expand All @@ -272,13 +257,8 @@ jobs:
steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
run: xbps-install -Syu xbps && xbps-install -yu

- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand Down Expand Up @@ -314,25 +294,16 @@ jobs:
- build-sbc-img

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
image: 'ghcr.io/void-linux/void-mklive:20250116R1'
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"

steps:
- name: Prepare container
shell: sh
run: |
# Switch to mirror
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install depedencies
xbps-install -yu bash make git outils
run: xbps-install -Syu xbps && xbps-install -yu

- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand Down
10 changes: 10 additions & 0 deletions container/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ghcr.io/void-linux/void-glibc-full:latest

ARG MIRROR="https://repo-default.voidlinux.org/"

RUN xbps-install -SyuR "${MIRROR}/current" xbps \
&& xbps-install -yuR "${MIRROR}/current" \
&& xbps-install -yuR "${MIRROR}/current" \
bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs

CMD ["/bin/sh"]
20 changes: 20 additions & 0 deletions container/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "MIRROR" {
default = "https://repo-ci.voidlinux.org/"
}

target "docker-metadata-action" {}

target "_common" {
inherits = ["docker-metadata-action"]
dockerfile = "container/Containerfile"
cache-to = ["type=local,dest=/tmp/buildx-cache"]
cache-from = ["type=local,src=/tmp/buildx-cache"]
args = {
"MIRROR" = "${MIRROR}"
}
}

target "void-mklive" {
inherits = ["_common"]
platforms = ["linux/amd64"]
}
Loading