Compare commits

..

No commits in common. "b64d043dcdd8d3264e9d9e354bfc9580d0f3bd77" and "8ecbf02341e327fbaf8dce118daf4933abe37b77" have entirely different histories.

3 changed files with 19 additions and 54 deletions

View File

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

View File

@ -1,19 +0,0 @@
# Start with the AlmaLinux 9 base image
FROM git.query.consul/unkin/almalinux9:latest
# Clean and update the repository cache
RUN dnf clean all && \
dnf makecache
# Install nodejs:20 for actions
RUN dnf module enable -y nodejs:20 && \
dnf install -y nodejs
# Install packages
RUN dnf install -y yum-utils && \
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \
dnf install -y docker-ce-cli make bash git unzip
# Cleanup
RUN dnf clean all && \
rm -rf /var/cache/dnf