-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
45 lines (37 loc) · 1.31 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
SHELL := /usr/bin/env bash
# Verbosity
AT_ = @
AT = $(AT_$(V))
# /Verbosity
GIT_HASH := $(shell git rev-parse --short=7 HEAD)
IMAGETAG ?= ${GIT_HASH}
BASE_IMG ?= hypershift-dataplane-metrics-forwarder-package
IMG_REGISTRY ?= quay.io
IMG_ORG ?= app-sre
IMG ?= $(IMG_REGISTRY)/$(IMG_ORG)/${BASE_IMG}
CONTAINER_ENGINE ?= $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
.PHONY: build-image
build-image:
$(CONTAINER_ENGINE) build -t $(IMG):$(IMAGETAG) -f $(join $(CURDIR),/build/Dockerfile) . && \
$(CONTAINER_ENGINE) tag $(IMG):$(IMAGETAG) $(IMG):latest
.PHONY: build-push
build-push:
build/build_push.sh $(IMG):$(IMAGETAG)
.PHONY: skopeo-push
skopeo-push:
@if [[ -z $$QUAY_USER || -z $$QUAY_TOKEN ]]; then \
echo "You must set QUAY_USER and QUAY_TOKEN environment variables" ;\
echo "ex: make QUAY_USER=value QUAY_TOKEN=value $@" ;\
exit 1 ;\
fi
# QUAY_USER and QUAY_TOKEN are supplied as env vars
skopeo copy --dest-creds "${QUAY_USER}:${QUAY_TOKEN}" \
"containers-storage:${IMG}:${IMAGETAG}" \
"docker://${IMG}:latest"
skopeo copy --dest-creds "${QUAY_USER}:${QUAY_TOKEN}" \
"containers-storage:${IMG}:${IMAGETAG}" \
"docker://${IMG}:${IMAGETAG}"
.PHONY: push-image
push-image: build/Dockerfile
$(CONTAINER_ENGINE) push $(IMG):$(IMAGETAG)
$(CONTAINER_ENGINE) push $(IMG):latest