-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
30 lines (23 loc) · 858 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
default: build
IMAGE_NAME = tomerfi/switcher_webapi
GIT_COMMIT = $(strip $(shell git rev-parse --short HEAD))
CURRENT_DATE = $(strip $(shell date -u +"%Y-%m-%dT%H:%M:%SZ"))
CODE_VERSION = $(strip $(shell cat VERSION))
FULL_IMAGE_NAME = $(strip $(IMAGE_NAME):$(CODE_VERSION))
PLATFORMS = linux/amd64,linux/arm/v7,linux/arm64/v8
ifndef CODE_VERSION
$(error You need to create a VERSION file to build the image.)
endif
build: enable-multiarch
docker buildx build \
--build-arg VCS_REF=$(GIT_COMMIT) \
--build-arg BUILD_DATE=$(CURRENT_DATE) \
--build-arg VERSION=$(CODE_VERSION) \
--platform $(PLATFORMS) \
--tag $(FULL_IMAGE_NAME) \
--tag $(IMAGE_NAME):latest .
dockerfile-lint:
npx dockerfilelint Dockerfile
enable-multiarch:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
.PHONY: build dockerfile-lint enable-multiarch