Squashed '.gitlab/' changes from cf41f2e..16ee2f3

16ee2f3 Merge branch 'various-docker-fixes' into 'main'
5b3e196 fix docker build and remove release
4bf9d45 Merge branch 'prefix-docker-commands' into 'main'
91b77b3 don't reset head after subtree pull, it breaks things
66b4362 prefix all docker commands with docker-
ba2827a Merge branch 'allow-specify-branch' into 'main'
4de5558 ignore .gitlab
71ff227 Allow pulling specific branch with BRANCH_NAME
6430416 Merge branch 'add-helm-and-kube' into 'main'
bce675f Add install, upgrade, and uninstall for helm
1532f30 Add kubectl.makefile

git-subtree-dir: .gitlab
git-subtree-split: 16ee2f3ddcc1235cb4a6b7a38c82d52859e8408f
This commit is contained in:
ducoterra
2021-12-13 12:58:40 -05:00
parent 44975664b6
commit 8096a291e6
5 changed files with 41 additions and 20 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.gitlab

View File

@@ -6,13 +6,16 @@ IMAGE ?= $(shell cat IMAGE):$(VERSION)
IMAGE_LATEST ?= $(shell cat IMAGE):latest
PWD ?= $(shell pwd)
STASH ?= "common-update-stash"
MAKE_BRANCH ?= main
include .gitlab/make/docker.makefile
include .gitlab/make/helm.makefile
include .gitlab/make/kaniko.makefile
include .gitlab/make/truenas.makefile
include .gitlab/make/git.makefile
include .gitlab/make/kubectl.makefile
# git subtree add --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
.PHONY: make-update
make-update:
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git $(MAKE_BRANCH)

View File

@@ -3,27 +3,21 @@ docker-init:
@touch VERSION
@touch IMAGE
.PHONY: buildx-context
buildx-context:
docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
.PHONY: docker-buildx-context
docker-buildx-context:
@docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
.PHONY: buildx-clear
buildx-clear:
docker buildx rm container-builder
.PHONY: docker-buildx-clear
docker-buildx-clear:
@docker buildx rm container-builder
.PHONY: build
build:
docker buildx build --load . -t $(IMAGE)
@docker buildx build --load . -t $(IMAGE_LATEST)
.PHONY: docker-build
docker-build:
docker build . -t $(IMAGE)
.PHONY: push
push:
-make buildx-clear
@make buildx-context
.PHONY: docker-push
docker-push:
-make docker-buildx-clear
@make docker-buildx-context
docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE)
@docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE_LATEST)
.PHONY: docker-release
docker-release:
@yq e ".services.minecraft.image = \"$(IMAGE)\"" -i docker-compose.yaml
@make push

View File

@@ -2,3 +2,15 @@
helm-release:
@yq e ".version = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
@yq e ".appVersion = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
.PHONY: install
install: set-namespace
helm install $(PROJECT_NAME) ./helm --set image=$(IMAGE)
.PHONY: upgrade
upgrade: set-namespace
helm upgrade $(PROJECT_NAME) ./helm --set image=$(IMAGE)
.PHONY: uninstall
uninstall: set-namespace
helm uninstall $(PROJECT_NAME)

11
make/kubectl.makefile Normal file
View File

@@ -0,0 +1,11 @@
.PHONY: set-namespace
set-namespace:
kubectl config set contexts.$(shell kubectl config current-context).namespace $(shell cat NAMESPACE)
.PHONY: create-regcred
create-regcred:
@kubectl create secret docker-registry regcred \
--docker-server=registry.ducoterra.net \
--docker-username=$(shell vault kv get -field username secret/duconet/basic-auth) \
--docker-password='$(shell vault kv get -field password secret/duconet/basic-auth)' \
--docker-email=$(shell vault kv get -field username secret/duconet/basic-auth)