Compare commits

..

No commits in common. "d92a0cccebbe5877507b78fc1879ec02db234883" and "146b4d28089d1679469c2a9eb2a5a238d7976f90" have entirely different histories.

3 changed files with 22 additions and 51 deletions

View File

@ -1,48 +1,35 @@
# Variables # Get the current Git commit hash
GIT_COMMIT := $(shell git rev-parse --short HEAD) GIT_COMMIT := $(shell git rev-parse --short HEAD)
# Get the current date in YYYYMMDD format
DATE_TAG := $(shell date +%Y%m%d) DATE_TAG := $(shell date +%Y%m%d)
# Set the Docker image name and repository information
IMAGE_NAME := almalinux8-buildagent
REGISTRY := git.query.consul REGISTRY := git.query.consul
OWNER := unkin OWNER := unkin
# List of releases (directories under ./release) # Build the Docker image (without tags)
RELEASES := $(shell find release -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) build:
docker build \
--network=host \
-t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) .
# Build all releases # Tag the Docker image with the Git commit hash, the date, and 'latest'
build: $(addprefix build-,$(RELEASES)) tag:
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
# Tag all releases # Push the Docker image to a repository with all tags
tag: $(addprefix tag-,$(RELEASES)) push: tag
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
# Push all releases # Clean up dangling Docker images
push: $(addprefix push-,$(RELEASES))
# Clean dangling images
clean: clean:
docker image prune -f docker image prune -f
# List all available releases
list:
@echo "Available releases:"
@echo $(RELEASES) | tr ' ' '\n'
# Build a specific release
build-%:
$(info Building almalinux$*-buildagent Docker image)
docker build --network=host -t $(REGISTRY)/$(OWNER)/almalinux$*-buildagent -f release/$*/Dockerfile release/$*
# Tag a specific release
tag-%:
$(info Tagging almalinux$*-buildagent Docker image)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(GIT_COMMIT)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(DATE_TAG)
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-buildagent $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:latest
# Push a specific release
push-%: tag-%
$(info Pushing almalinux$*-buildagent Docker image)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(GIT_COMMIT)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:$(DATE_TAG)
docker push $(REGISTRY)/$(OWNER)/almalinux$*-buildagent:latest
# Default target # Default target
default: build default: build

View File

@ -1,16 +0,0 @@
# Start with the AlmaLinux 9 base image
FROM git.query.consul/unkin/almalinux9:latest
# Install nodejs:20 for actions
RUN dnf module enable -y nodejs:20 && \
dnf install -y nodejs
# Install build tools and dependencies for building RPMs
RUN dnf clean all && \
dnf makecache && \
dnf groupinstall -y 'Development Tools' && \
dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget tar gzip go nfpm
# Cleanup
RUN dnf clean all && \
rm -rf /var/cache/dnf