|
All checks were successful
Deploy / build (push) Successful in 1m49s
Reviewed-on: https://git.query.consul/unkin/docker-almalinux-runnerdnd/pulls/4 |
||
|---|---|---|
| .gitea/workflows | ||
| release | ||
| Makefile | ||
| README.md | ||
Docker Image Build: Almalinux Docker-in-Docker
This project provides a reproducible Docker image build process for almalinux:8.10, with custom YUM repository configurations and package installations. The build is automated using a Makefile and managed via CI tasks to ensure consistent and reliable Docker image builds.
Makefile Overview
The Makefile provides several targets to automate building, tagging, and pushing Docker images. The Docker image is tagged with the current Git commit hash, the current date, and a latest tag for easy reference.
Makefile Targets
Build the Docker Image
To build the Docker image without tags:
make build
This will use the docker build command with --network=host to build the image with the name git.query.consul/unkin/almalinux8-runnerdnd.
Tag the Docker Image
To tag the Docker image with the Git commit hash, the current date, and a latest tag:
make tag
This will add three tags to the image:
git.query.consul/unkin/almalinux8-runnerdnd:<GIT_COMMIT>git.query.consul/unkin/almalinux8-runnerdnd:<DATE_TAG>git.query.consul/unkin/almalinux8-runnerdnd:latest
Push the Docker Image
To push the tagged Docker images to the registry:
make push
Note
: The
pushcommand is currently commented out for safety. To enable pushing, remove the comment (#) from thedocker pushlines in thepushtarget.
Clean Up
To clean up any dangling Docker images:
make clean
This will remove any dangling (unused) Docker images using docker image prune -f.
Default Target
The default target is build. So running:
make
is equivalent to running make build.
Development and Testing
To test or develop with this Makefile, follow these steps:
-
Clone the repository and navigate to the project directory:
git clone https://git.query.consul/unkin/docker-almalinux-runnerdnd.git cd docker-almalinux-runnerdnd -
Build the Docker image using the
buildtarget:make build -
Tag the image with the commit hash, date, and latest tag:
make tag -
(Optional) Modify the
pushtarget to enable pushing the image to your Docker registry: Uncomment the lines in thepushtarget:docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT) docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG) docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest -
Test your changes locally by running the
cleantarget:make clean