-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
34 lines (29 loc) · 941 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
BUILD_TAG ?= latest
IMAGE_NAME = kubernetes-setup
ECR_URL = public.ecr.aws/sumologic
REPO_URL = $(ECR_URL)/$(IMAGE_NAME)
DOCKERFILE = Dockerfile
TAG_SUFFIX = ""
PLATFORMS = linux/amd64,linux/arm/v7,linux/arm64
build:
DOCKER_BUILDKIT=1 docker build \
-f $(DOCKERFILE) \
--build-arg BUILD_TAG=$(BUILD_TAG)$(TAG_SUFFIX) \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from $(REPO_URL):latest \
--tag $(IMAGE_NAME):$(BUILD_TAG)$(TAG_SUFFIX) \
.
push:
docker tag $(IMAGE_NAME):$(BUILD_TAG)$(TAG_SUFFIX) $(REPO_URL):$(BUILD_TAG)$(TAG_SUFFIX)
docker push $(REPO_URL):$(BUILD_TAG)$(TAG_SUFFIX)
login:
aws ecr-public get-login-password --region us-east-1 \
| docker login --username AWS --password-stdin $(ECR_URL)
build-push-multiplatform:
docker buildx build \
-f $(DOCKERFILE) \
--push \
--platform $(PLATFORMS) \
--build-arg BUILD_TAG=$(BUILD_TAG)$(TAG_SUFFIX) \
--tag $(REPO_URL):$(BUILD_TAG)$(TAG_SUFFIX) \
.