feat: initial commit
build-docker-image / push (pull_request) Has been skipped
build-docker-image / clean (pull_request) Failing after 12s
build-docker-image / build (pull_request) Failing after 14s

- add Makefile
- add gitea workflows
- add Dockerfile
This commit is contained in:
2024-09-08 00:15:21 +10:00
parent 0d3e7553ef
commit e2d7bca962
4 changed files with 123 additions and 2 deletions
+33
View File
@@ -0,0 +1,33 @@
# 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 := alma8-buildagent
REGISTRY := git.query.consul
OWNER := unkin
# Build the Docker image (without tags)
build:
docker build --network=host -t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) .
# 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
# 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
# Clean up dangling Docker images
clean:
docker image prune -f
# Default target
default: build