diff --git a/Makefile b/Makefile index 7da6367..cbb63e2 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,49 @@ -# Get the current Git commit hash +# Variables 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 +IMAGE_NAME := almalinux REGISTRY := git.query.consul OWNER := unkin -# Build the Docker image (without tags) -build: - docker build --network=host -t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) . +# List of releases (directories under ./release) +RELEASES := $(shell find release -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) -# 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 +# Default target (build all images) +default: build-all -# 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 +# List all available releases +list: + @echo "Available releases:" + @echo $(RELEASES) | tr ' ' '\n' -# Clean up dangling Docker images +# Build all releases +build: $(addprefix build-,$(RELEASES)) + +# Tag all releases +tag: $(addprefix tag-,$(RELEASES)) + +# Push all releases +push: $(addprefix push-,$(RELEASES)) + +# Clean dangling images clean: docker image prune -f -# Default target -default: build +# Build a specific release +build-%: + $(info Building AlmaLinux $* Docker image) + docker build --network=host -t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME)$* -f release/$*/Dockerfile release/$* + +# Tag a specific release +tag-%: + $(info Tagging AlmaLinux $* Docker image) + 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 + +# Push a specific release +push-%: tag-% + $(info Pushing AlmaLinux $* Docker image) + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME)$*:$(GIT_COMMIT) + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME)$*:$(DATE_TAG) + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME)$*:latest diff --git a/Dockerfile b/release/8/Dockerfile similarity index 100% rename from Dockerfile rename to release/8/Dockerfile diff --git a/files/appstream.repo b/release/8/files/appstream.repo similarity index 100% rename from files/appstream.repo rename to release/8/files/appstream.repo diff --git a/files/baseos.repo b/release/8/files/baseos.repo similarity index 100% rename from files/baseos.repo rename to release/8/files/baseos.repo diff --git a/files/epel.repo b/release/8/files/epel.repo similarity index 100% rename from files/epel.repo rename to release/8/files/epel.repo diff --git a/files/powertools.repo b/release/8/files/powertools.repo similarity index 100% rename from files/powertools.repo rename to release/8/files/powertools.repo diff --git a/files/unkin.repo b/release/8/files/unkin.repo similarity index 100% rename from files/unkin.repo rename to release/8/files/unkin.repo diff --git a/release/9/Dockerfile b/release/9/Dockerfile new file mode 100644 index 0000000..45842da --- /dev/null +++ b/release/9/Dockerfile @@ -0,0 +1,24 @@ +# Start with the base AlmaLinux 9.4 image +FROM almalinux:9.4 + +# Remove existing repos and copy custom repo files into the container +RUN rm -rf /etc/yum.repos.d/*.repo + +# Copy from the local context into the container +COPY files/*.repo /etc/yum.repos.d/ + +# Install ca-certs +RUN curl -k -o internal-ca-certificates.rpm https://git.query.consul/unkin/-/packages/rpm/internal-ca-certificates/20240825-1.el8/files/756 && \ + rpm -i internal-ca-certificates.rpm + +# Clean and update the repository cache +RUN dnf clean all && \ + dnf makecache + +# Update the system and install required packages +RUN dnf update -y && \ + dnf install -y curl-minimal git + +# Cleanup +RUN dnf clean all && \ + rm -rf /var/cache/dnf diff --git a/release/9/files/appstream.repo b/release/9/files/appstream.repo new file mode 100644 index 0000000..96c6b7e --- /dev/null +++ b/release/9/files/appstream.repo @@ -0,0 +1,4 @@ +[appstream] +name=appstream repository +baseurl=https://edgecache.query.consul/almalinux/9.4/AppStream/x86_64/os +gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-9 diff --git a/release/9/files/baseos.repo b/release/9/files/baseos.repo new file mode 100644 index 0000000..963fc26 --- /dev/null +++ b/release/9/files/baseos.repo @@ -0,0 +1,4 @@ +[baseos] +name=baseos repository +baseurl=https://edgecache.query.consul/almalinux/9.4/BaseOS/x86_64/os +gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-9 diff --git a/release/9/files/crb.repo b/release/9/files/crb.repo new file mode 100644 index 0000000..b1bae22 --- /dev/null +++ b/release/9/files/crb.repo @@ -0,0 +1,4 @@ +[crb] +name=crb repository +baseurl=https://edgecache.query.consul/almalinux/9.4/CRB/x86_64/os +gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-9 diff --git a/release/9/files/epel.repo b/release/9/files/epel.repo new file mode 100644 index 0000000..433e769 --- /dev/null +++ b/release/9/files/epel.repo @@ -0,0 +1,4 @@ +[epel] +name=epel repository +baseurl=https://edgecache.query.consul/epel/9/Everything/x86_64 +gpgkey=http://edgecache.query.consul/epel/RPM-GPG-KEY-EPEL-9 diff --git a/release/9/files/extras.repo b/release/9/files/extras.repo new file mode 100644 index 0000000..a312c2c --- /dev/null +++ b/release/9/files/extras.repo @@ -0,0 +1,4 @@ +[extras] +name=extras repository +baseurl=https://edgecache.query.consul/almalinux/9.4/extras/x86_64/os +gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-9 diff --git a/release/9/files/highavailability.repo b/release/9/files/highavailability.repo new file mode 100644 index 0000000..c8483ea --- /dev/null +++ b/release/9/files/highavailability.repo @@ -0,0 +1,4 @@ +[highavailability] +name=highavailability repository +baseurl=https://edgecache.query.consul/almalinux/9.4/HighAvailability/x86_64/os +gpgkey=http://edgecache.query.consul/almalinux/RPM-GPG-KEY-AlmaLinux-9 diff --git a/release/9/files/unkin.repo b/release/9/files/unkin.repo new file mode 100644 index 0000000..c98b19a --- /dev/null +++ b/release/9/files/unkin.repo @@ -0,0 +1,10 @@ +[unkin] +name=unkin repository +baseurl=https://git.query.consul/api/packages/unkin/rpm/almalinux/el8 +gpgcheck=False +gpgkey=https://git.query.consul/api/packages/unkin/rpm/repository.key +[unkinben] +name=unkinben repository +baseurl=https://git.query.consul/api/packages/unkinben/rpm/el9 +gpgcheck=False +gpgkey=https://git.query.consul/api/packages/unkinben/rpm/repository.key