From 2da027088e021954febeb61a8fe307c6845dd2e0 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Wed, 5 Nov 2025 07:03:56 -0600 Subject: [PATCH] Add container image building --- Makefile | 6 ++++++ buildtools/build-containerimage | 15 +++++++++++++++ buildtools/containerimage/Containerfile | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100755 buildtools/build-containerimage create mode 100644 buildtools/containerimage/Containerfile diff --git a/Makefile b/Makefile index a7eeaa00..5e4133e6 100644 --- a/Makefile +++ b/Makefile @@ -336,6 +336,7 @@ install-build-tools: define build_release $(eval GITREF ?= $(shell git describe --exact-match --tags HEAD 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)) + @echo "GITREF=$(GITREF)" ./buildtools/build-release \ --target=$(1) \ $(if $(CLEANUP),--cleanup) \ @@ -364,6 +365,11 @@ release-static: release-tarball: $(call build_release,"tarball") +container: + $(eval GITREF ?= $(shell git describe --exact-match --tags HEAD 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)) + @echo "GITREF=$(GITREF)" + ./buildtools/build-containerimage "$(GITREF)" + .PHONY: tags tags: rm -fv TAGS diff --git a/buildtools/build-containerimage b/buildtools/build-containerimage new file mode 100755 index 00000000..62047438 --- /dev/null +++ b/buildtools/build-containerimage @@ -0,0 +1,15 @@ +#!/bin/sh + +GIT_BRANCH="${1:-master}" + +podman \ + build \ + --squash \ + --no-cache \ + --force-rm \ + --build-arg="GIT_REPO=file:///mnt" \ + --build-arg="BRANCH=${GIT_BRANCH}" \ + -v "${PWD}":/mnt:ro \ + -f "buildtools/containerimage/Containerfile" \ + --tag "mergerfs:${GIT_BRANCH}" \ + buildtools/ diff --git a/buildtools/containerimage/Containerfile b/buildtools/containerimage/Containerfile new file mode 100644 index 00000000..7f4261e4 --- /dev/null +++ b/buildtools/containerimage/Containerfile @@ -0,0 +1,19 @@ +FROM --platform=linux/amd64 alpine:latest as build + +ARG GIT_REPO +ARG BRANCH + +RUN <