forked from strimzi/strimzi-canary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.docker
35 lines (30 loc) · 1.1 KB
/
Makefile.docker
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
DOCKER_REGISTRY ?= docker.io
DOCKER_ORG ?= $(USER)
DOCKER_TAG ?= latest
BUILD_TAG ?= latest
.PHONY: docker_build
docker_build:
# Build Docker image ...
echo "Building Docker image ..."
docker build -t strimzi/${PROJECT_NAME}:latest .
# Also tag with $(BUILD_TAG)
docker tag strimzi/$(PROJECT_NAME):latest strimzi/$(PROJECT_NAME):$(BUILD_TAG)
.PHONY: docker_save
docker_save:
# Saves the container as TGZ file
echo "Saving Docker image as tar.gz file ..."
docker save strimzi/${PROJECT_NAME}:${BUILD_TAG} | gzip > canary-container.tar.gz
.PHONY: docker_load
docker_load:
# Loads the container as TGZ file
echo "Loading Docker image from tar.gz file ..."
docker load < canary-container.tar.gz
.PHONY: docker_tag
docker_tag:
# Tag the $(BUILD_TAG) image we built with the given $(DOCKER_TAG) tag
docker tag strimzi/$(PROJECT_NAME):$(BUILD_TAG) $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(PROJECT_NAME):$(DOCKER_TAG)
.PHONY: docker_push
docker_push: docker_tag
# Push the $(DOCKER_TAG)-tagged image to the registry
echo "Pushing Docker image ..."
docker push ${DOCKER_REGISTRY}/${DOCKER_ORG}/${PROJECT_NAME}:${DOCKER_TAG}