-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (50 loc) · 2.33 KB
/
Makefile
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
IMAGE?=saniewski/mongo-express-docker-extension
TAG_LATEST?=latest
TAG_MAJOR?=1
TAG_MINOR?=1.0
TAG_PATCH?=1.0.2
BUILDER=buildx-multi-arch
INFO_COLOR = \033[0;36m
NO_COLOR = \033[m
ADDITIONAL_URLS = $(shell cat ./docs/extension-labels/additional-urls.json)
CHANGELOG = $(shell cat ./docs/extension-labels/changelog.html)
DETAILED_DESCRIPTION = $(shell cat ./docs/extension-labels/detailed-description.html)
SCREENSHOTS = $(shell cat ./docs/extension-labels/screenshots.json)
build-extension: ## Build service image to be deployed as a desktop extension
docker build \
--tag=$(IMAGE):$(TAG_LATEST) \
--tag=$(IMAGE):$(TAG_MAJOR) \
--tag=$(IMAGE):$(TAG_MINOR) \
--tag=$(IMAGE):$(TAG_PATCH) \
--build-arg ADDITIONAL_URLS='$(ADDITIONAL_URLS)' \
--build-arg CHANGELOG='$(CHANGELOG)' \
--build-arg DETAILED_DESCRIPTION='$(DETAILED_DESCRIPTION)' \
--build-arg SCREENSHOTS='$(SCREENSHOTS)' \
.
install-extension: build-extension ## Install the extension
docker extension install $(IMAGE):$(TAG_PATCH)
update-extension: build-extension ## Update the extension
docker extension update $(IMAGE):$(TAG_PATCH)
use-devtools: ## Use DevTools inside the Docker Desktop extension
docker extension dev debug ${IMAGE}
use-local-ui: ## Use local UI files instead of container's files
docker extension dev ui-source ${IMAGE} http://localhost:3000
reset-dev: ## Resets any development settings changes
docker extension dev reset ${IMAGE}
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
push-extension: prepare-buildx ## Build & upload extension image to hub.
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 \
--tag=$(IMAGE):$(TAG_LATEST) \
--tag=$(IMAGE):$(TAG_MAJOR) \
--tag=$(IMAGE):$(TAG_MINOR) \
--tag=$(IMAGE):$(TAG_PATCH) \
--build-arg ADDITIONAL_URLS='$(ADDITIONAL_URLS)' \
--build-arg CHANGELOG='$(CHANGELOG)' \
--build-arg DETAILED_DESCRIPTION='$(DETAILED_DESCRIPTION)' \
--build-arg SCREENSHOTS='$(SCREENSHOTS)' \
.
help: ## Show this help
@echo Please specify a build target. The choices are:
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}'
.PHONY: help