Improve Docker-based build & test pipeline for pkgmgr

- Add .dockerignore rules to prevent Arch package artifacts from entering the build context
- Rework Dockerfile to remove stale package artifacts before makepkg and use a dev entry script
- Introduce docker-entry-dev.sh to always rebuild pkgmgr from the mounted /src tree
- Update Makefile 'test' target to rebuild pkgmgr inside the container before running tests
- Fix predictable makepkg failures caused by residual *.pkg.tar.* files

Conversation reference: https://chatgpt.com/share/6935e6e8-f3fc-800f-a4e9-7537114f13d1
This commit is contained in:
Kevin Veen-Birkenbach
2025-12-07 21:43:38 +01:00
parent 225d6a84b7
commit 9679478353
5 changed files with 49 additions and 9 deletions

View File

@@ -13,20 +13,21 @@ ENV NIX_CONFIG="experimental-features = nix-command flakes"
# 2) Unprivileged user for building Arch packages
RUN useradd -m builder
# 3) Build-Stage (optional): einmal aus /build bauen, wenn du magst
WORKDIR /build
# 3) Only PKGBUILD rein, um dein Wrapper-Paket zu bauen
COPY . .
RUN chown -R builder:builder /build \
&& su builder -c "makepkg -s --noconfirm --clean" \
&& su builder -c "cd /build && rm -f package-manager-*.pkg.tar.* && makepkg -sf --noconfirm --clean" \
&& pacman -U --noconfirm package-manager-*.pkg.tar.* \
&& rm -rf /build
# 4) Projekt-Quellen für Tests in den Container kopieren
# 4) Runtime-Workingdir für das gemountete Repo
WORKDIR /src
COPY . .
# pkgmgr (Arch-Package) ist installiert und ruft nix run auf.
ENTRYPOINT ["pkgmgr"]
# 5) Entry-Script für „always build from /src“
COPY scripts/docker-entry-dev.sh /usr/local/bin/docker-entry-dev.sh
RUN chmod +x /usr/local/bin/docker-entry-dev.sh
ENTRYPOINT ["/usr/local/bin/docker-entry-dev.sh"]
CMD ["--help"]