forked from Accedian/local-reverse-geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (35 loc) · 1.67 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
DOCKER_REPO_NAME := gcr.io/npav-172917/
ifndef DOCKERFILE_TARGET
$(error DOCKERFILE_TARGET is not set, cannot determine which Dockerfile to make)
endif
ifndef CONTAINER_REGISTRY
$(error CONTAINER_REGISTRY is not set, cannot determine where this image will be pushed)
endif
PWD := $(shell pwd)
UNAME := $(shell uname -m)
LOCAL_BUILD_PLATFORM := linux/amd64
ifeq ($(UNAME),arm64)
LOCAL_BUILD_PLATFORM = linux/arm64/v8
endif
BUILD_PLATFORMS ?= linux/amd64,linux/arm64/v8
dockerbin: .FORCE
npm install
docker: dockerbin
echo "building with $(LOCAL_BUILD_PLATFORM)"
docker buildx build --platform $(LOCAL_BUILD_PLATFORM) -t $(DOCKER_REPO_NAME)$(CONTAINER_REGISTRY):$(DOCKER_VER) --load --file $(DOCKERFILE_TARGET) .
push: dockerbin
echo "building with $(BUILD_PLATFORMS)"
docker buildx build --platform $(BUILD_PLATFORMS) -t $(DOCKER_REPO_NAME)$(CONTAINER_REGISTRY):$(DOCKER_VER) --file $(DOCKERFILE_TARGET) --push .
circleci-push:
echo "building with $(BUILD_PLATFORMS)"
docker buildx build --platform $(BUILD_PLATFORMS) -t $(DOCKER_REPO_NAME)$(CONTAINER_REGISTRY):$(DOCKER_VER) --file $(DOCKERFILE_TARGET) --push .
circleci-docker:
echo "building with $(BUILD_PLATFORMS)"
docker buildx build --platform $(LOCAL_BUILD_PLATFORM) -t $(DOCKER_REPO_NAME)$(CONTAINER_REGISTRY):$(DOCKER_VER) --load --file $(DOCKERFILE_TARGET) --progress=plain --no-cache .
circleci-push-latest:
echo "building and pushing latest with $(BUILD_PLATFORMS)"
docker buildx build --platform $(BUILD_PLATFORMS) -t $(DOCKER_REPO_NAME)$(CONTAINER_REGISTRY):latest --file $(DOCKERFILE_TARGET) --push .
.FORCE:
clean:
rm -rf $(POST_BUILD_CLEANUP_DIR)
# Make commands for targets in monorepo to reduce number of arguments