-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (32 loc) · 998 Bytes
/
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
VERSION ?= $(shell git describe --always --dirty)
ARCHS ?= linux/amd64,linux/arm/v7
GH_USER ?= hoegaarden
REPO ?= ghcr.io/$(GH_USER)/deye-inverter-mqtt-plugins
BUILDX_BUILDER ?= deye-inverter-mqtt-plugins
BASE_IMAGE ?= $(REPO):base-$(VERSION)
IMAGE ?= $(REPO):$(VERSION)
test:
PYTHONPATH="$${PWD}/deye-inverter-mqtt/src" pytest -v plugins
docker.build: test docker.build.base
docker buildx build \
--builder "$(BUILDX_BUILDER)" \
--platform "$(ARCHS)" \
--build-arg "BASE_IMAGE=$(BASE_IMAGE)" \
--push \
--tag "$(IMAGE)" \
.
docker.build.base: docker.build.setup
cd deye-inverter-mqtt && docker buildx build \
--builder "$(BUILDX_BUILDER)" \
--platform "$(ARCHS)" \
--push \
--tag "$(BASE_IMAGE)" \
.
docker.build.setup:
docker buildx ls | grep -q "$(BUILDX_BUILDER)" || { \
docker buildx create --name "$(BUILDX_BUILDER)" ; \
}
docker.build.cleanup:
docker buildx ls | grep -q "$(BUILDX_BUILDER)" && { \
docker buildx rm --builder "$(BUILDX_BUILDER)" ; \
}