diff --git a/.gitlab/Makefile b/.gitlab/Makefile new file mode 100644 index 0000000..1575e0d --- /dev/null +++ b/.gitlab/Makefile @@ -0,0 +1,10 @@ +SHELL := /bin/bash + +IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION) +IMAGE_LATEST ?= $(shell cat IMAGE):latest +PWD ?= $(shell pwd) + +include .gitlab/make/docker.makefile +include .gitlab/make/helm.makefile +include .gitlab/make/kaniko.makefile +include .gitlab/make/truenas.makefile diff --git a/.gitlab/README.md b/.gitlab/README.md new file mode 100644 index 0000000..1d084b1 --- /dev/null +++ b/.gitlab/README.md @@ -0,0 +1,10 @@ +# Adding the "common" subtree as your .gitlab folder + +```bash +# Add the subtree as a remote +git remote add common git@gitlab.ducoterra.net:services/common.git +git subtree add --prefix .gitlab common main + +# Now you can run the following to update +git subtree pull --prefix .gitlab common main +``` diff --git a/.gitlab/make/docker.makefile b/.gitlab/make/docker.makefile new file mode 100644 index 0000000..4af850f --- /dev/null +++ b/.gitlab/make/docker.makefile @@ -0,0 +1,26 @@ +.PHONY: docker-init +docker-init: + @touch VERSION + @touch IMAGE + +.PHONY: buildx-context +buildx-context: + docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64 + +.PHONY: buildx-clear +buildx-clear: + docker buildx rm arm64 + +.PHONY: build +build: + docker buildx build --load . -t $(IMAGE) + @docker buildx build --load . -t $(IMAGE_LATEST) + +.PHONY: push +push: + docker buildx build --platform linux/amd64 --push . -t $(IMAGE) + @docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST) + +.PHONY: run +run: + docker run -it -v $(PWD):/mc_data $(IMAGE) bash diff --git a/.gitlab/make/helm.makefile b/.gitlab/make/helm.makefile new file mode 100644 index 0000000..f603af4 --- /dev/null +++ b/.gitlab/make/helm.makefile @@ -0,0 +1,4 @@ +.PHONY: helm-release +helm-release: + @yq e ".version = \"$(shell cat VERSION)\"" -i helm/Chart.yaml + @yq e ".appVersion = \"$(shell cat VERSION)\"" -i helm/Chart.yaml diff --git a/.gitlab/make/kaniko.makefile b/.gitlab/make/kaniko.makefile new file mode 100644 index 0000000..e69de29 diff --git a/.gitlab/make/truenas.makefile b/.gitlab/make/truenas.makefile new file mode 100644 index 0000000..c6fb58c --- /dev/null +++ b/.gitlab/make/truenas.makefile @@ -0,0 +1,3 @@ +.PHONY: chart-release +chart-release: + @rsync -av $(CHART)/helm/ charts/$(CHART)/$(shell cat $(CHART)/VERSION)/