Compare commits

15 Commits

Author SHA1 Message Date
Reese
465f46ad48 Merge branch 'add-docker-compose-targets' into 'main'
Add docker compose targets

See merge request services/common!10
2021-12-13 20:13:39 +00:00
ducoterra
f6aed2c86a add docker-compose init, up, and down targets 2021-12-13 15:11:00 -05:00
ducoterra
88716ad3ff populate default values for VERSION and IMAGE file when docker-init is run 2021-12-13 15:05:52 -05:00
Reese
16ee2f3ddc Merge branch 'various-docker-fixes' into 'main'
fix docker build and remove release

See merge request services/common!9
2021-12-13 00:33:44 +00:00
ducoterra
5b3e196267 fix docker build and remove release 2021-12-12 19:30:55 -05:00
Reese
4bf9d45797 Merge branch 'prefix-docker-commands' into 'main'
prefix all docker commands with docker-

See merge request services/common!7
2021-12-13 00:26:23 +00:00
ducoterra
91b77b3d31 don't reset head after subtree pull, it breaks things 2021-12-12 19:26:02 -05:00
ducoterra
66b436219f prefix all docker commands with docker- 2021-12-12 19:20:30 -05:00
Reese
ba2827a8fe Merge branch 'allow-specify-branch' into 'main'
Allow pulling specific branch with BRANCH_NAME

See merge request services/common!8
2021-12-13 00:18:38 +00:00
ducoterra
4de5558b63 ignore .gitlab 2021-12-12 19:16:01 -05:00
ducoterra
71ff227953 Allow pulling specific branch with BRANCH_NAME
Allow make-update and make-add to specify a branch name to pull an
update from.
2021-12-12 19:16:01 -05:00
Reese
64304160b9 Merge branch 'add-helm-and-kube' into 'main'
Add kubectl.makefile

See merge request services/common!6
2021-12-06 03:20:04 +00:00
ducoterra
bce675fbd2 Add install, upgrade, and uninstall for helm
Add helm commands to handle installing and uninstall an app.
2021-12-05 22:13:38 -05:00
ducoterra
1532f30641 Add kubectl.makefile
Add kubectl make commands like set-namespace and create-regcred.
2021-12-05 22:13:32 -05:00
Reese
cf41f2e776 Merge branch 'remove-push' into 'main'
Add automated commit to chart-release

See merge request services/common!5
2021-11-02 19:47:43 +00:00
5 changed files with 56 additions and 21 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

@@ -1,29 +1,37 @@
.PHONY: docker-init
docker-init:
@touch VERSION
@touch IMAGE
@echo "0.0.1" >> VERSION
@echo "$(PROJECT_NAME)" >> 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
.PHONY: docker-compose-init
docker-compose-init:
@touch docker-compose.yaml
@yq e ".version = \"3\"" -i docker-compose.yaml
@yq e ".services.main.image = \"$(IMAGE)\"" -i docker-compose.yaml
.PHONY: docker-compose-up
docker-compose-up:
docker-compose up -d
.PHONY: docker-compose-down
docker-compose-down:
docker-compose down

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)