Skip to content

Commit

Permalink
fixing base image tag and adding git commit to the base image (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
divyenpatel committed Aug 30, 2021
1 parent e6d94ab commit d7ad25a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions images/driver-base/Dockerfile
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.

FROM photon:4.0
ARG GIT_COMMIT
LABEL git_commit=$GIT_COMMIT
LABEL "maintainers"="Divyen Patel <divyenp@vmware.com>, Sandeep Pissay Srinivasa Rao <ssrinivas@vmware.com>, Xing Yang <yangxi@vmware.com>"

RUN tdnf -y upgrade && tdnf clean all
13 changes: 6 additions & 7 deletions images/driver-base/Makefile
Expand Up @@ -16,24 +16,23 @@ all: build

include ../../hack/make/login-to-image-registry.mk

VERSION ?= $(shell git describe --always --dirty)
IMAGE_NAME ?= $(REGISTRY)/extra/csi-driver-base
IMAGE_TAG ?= $(IMAGE_NAME):$(VERSION)
IMAGE_NAME_WITH_TAG ?= $(IMAGE_NAME):$(shell git log -1 --format=%h)

build:
docker build -t $(IMAGE_TAG) .
docker tag $(IMAGE_TAG) $(IMAGE_NAME):latest
docker build -t $(IMAGE_NAME_WITH_TAG) --build-arg GIT_COMMIT=$(shell git log -1 --format=%H) .
docker tag $(IMAGE_NAME_WITH_TAG) $(IMAGE_NAME):latest
.PHONY: build

push: login-to-image-registry
docker push $(IMAGE_TAG)
docker push $(IMAGE_NAME_WITH_TAG)
docker push $(IMAGE_NAME):latest
.PHONY: push

.PHONY: clean
DOCKER_RMI_FLAGS := --no-prune
clean:
docker rmi $(DOCKER_RMI_FLAGS) $(IMAGE_TAG) $(IMAGE_NAME):latest 2>/dev/null || true
docker rmi $(DOCKER_RMI_FLAGS) $(IMAGE_NAME_WITH_TAG) $(IMAGE_NAME):latest 2>/dev/null || true

.PHONY: clobber
clobber: DOCKER_RMI_FLAGS :=
Expand All @@ -42,4 +41,4 @@ clobber: clean

.PHONY: print
print:
@echo $(IMAGE_TAG)
@echo $(IMAGE_NAME_WITH_TAG)

0 comments on commit d7ad25a

Please sign in to comment.