-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (65 loc) · 2.73 KB
/
Copy pathMakefile
File metadata and controls
80 lines (65 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Build / install helpers for the Heimdall Cloudron package.
#
# Prerequisites:
# npm install -g cloudron
# cloudron login my.<your-cloudron-domain>
# docker login ghcr.io -u <github-user> # PAT with write:packages
#
# Common targets:
# make install build & install on the Cloudron server
# make update update an already-installed instance
# make rebuild cloudron build + cloudron update in one go
# make build push build locally with Docker, push to a registry
# make image-install install a previously pushed image
# make logs tail the running app log
# make exec shell into the running container
# make uninstall remove the app from the Cloudron server
#
# Override on the command line, e.g.:
# make install LOCATION=start
# make update APP_FQDN=start.staude.cc
# make build PUSH_IMAGE=ghcr.io/staude/heimdall:0.1.0
SHELL := /bin/bash
# Cloudron servers run linux/amd64. When building on Apple Silicon, Docker
# Buildx would otherwise produce a multi-platform manifest that Cloudron
# can't unpack — pin the build target.
export DOCKER_DEFAULT_PLATFORM ?= linux/amd64
LOCATION ?= start
DOMAIN ?= staude.cc
PUSH_IMAGE ?=
APP_FQDN ?= $(LOCATION).$(DOMAIN)
.PHONY: help install update rebuild build push image-install logs exec uninstall lint
help:
@grep -E '^# [a-zA-Z]+:|^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) || true
@awk 'BEGIN{FS=":.*?## "} /^[a-zA-Z_-]+:.*?## /{printf " %-18s %s\n",$$1,$$2}' $(MAKEFILE_LIST)
install: ## Build and install the package on the Cloudron server
cloudron install --location $(LOCATION)
update: ## Update an already-installed instance with the current local image
cloudron update --app $(APP_FQDN)
rebuild: ## cloudron build + cloudron update in one go
cloudron build
cloudron update --app $(APP_FQDN)
build: ## Build the image locally with Docker
ifndef PUSH_IMAGE
$(error PUSH_IMAGE is unset; example: PUSH_IMAGE=ghcr.io/staude/heimdall:0.1.0)
endif
docker build -t $(PUSH_IMAGE) .
push: ## Push the locally-built image to its registry
ifndef PUSH_IMAGE
$(error PUSH_IMAGE is unset)
endif
docker push $(PUSH_IMAGE)
image-install: ## Install from a registry image (set PUSH_IMAGE first)
ifndef PUSH_IMAGE
$(error PUSH_IMAGE is unset)
endif
cloudron install --location $(LOCATION) --image $(PUSH_IMAGE)
logs: ## Tail the running app log
cloudron logs --app $(APP_FQDN) -f
exec: ## Open a shell in the running container
cloudron exec --app $(APP_FQDN)
uninstall: ## Remove the app from the Cloudron server
cloudron uninstall --app $(APP_FQDN)
lint: ## Validate manifest JSON locally
@command -v jq >/dev/null || { echo "jq not installed"; exit 1; }
@jq empty CloudronManifest.json && echo "CloudronManifest.json: OK"