Error when building image template on self-hosted Forgejo

I’m trying to build image template on self-hosted Forgejo instance and I’m getting some error. I’ve copied the entire template repository directly to my instance. Build workflow remains the same until the build step, where it fails.

Since I don’t have the exact runner that GitHub has here’s the approximation I’m using:

FROM ubuntu:24.04

RUN apt-get update && apt-get upgrade -y && \
    apt-get -y --no-install-recommends install buildah podman nodejs git ca-certificates

That’s the simplest build.sh I’m testing on withs lsof on file that’s related to the failure:

#!/bin/bash

set -ouex pipefail
lsof /etc/systemd/resolve/stub-resolv.conf || echo "Does not exist?"

And Containerfile:

FROM scratch AS ctx
COPY build_files /

RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
    --mount=type=cache,dst=/var/cache \
    --mount=type=cache,dst=/var/log \
    --mount=type=tmpfs,dst=/tmp \
    /ctx/build.sh && \
    ostree container commit

RUN bootc container lint

And the error I’m getting is below. It seems to be failing on ostree container commit and the file it refers to does not exist. I’m not sure if it’s related to running it on Forgejo with my custom runner, but I guess that may be the problem.

Writing manifest to image destination
[2/2] STEP 2/4: RUN --mount=type=bind,from=ctx,source=/,target=/ctx     --mount=type=cache,dst=/var/cache     --mount=type=cache,dst=/var/log     --mount=type=tmpfs,dst=/tmp     /ctx/build.sh &&     ostree container commit
+ lsof /etc/systemd/resolve/stub-resolv.conf
lsof: status error on /etc/systemd/resolve/stub-resolv.conf: No such file or directory
+ echo 'Does not exist?'
Does not exist?
ERROR Cleaning run: Removing "systemd/resolve/stub-resolv.conf": Device or resource busy (os error 16)

Does anyone have an idea what may be the problem here?

For the curious, I’ve narrowed it down to using the following image as a Forgejo runner:

FROM fedora:42

RUN dnf install -y buildah nodejs fuse-overlayfs && dnf clean all

Runner works in a rootless Podman container. I’m also using privileged: true in runner config, but I’m not sure at the moment if this is needed. Now the image builds and I can continue building complete workflow for my homelab.