Skip to content

Commit

Permalink
Merge pull request #329 from dell/build-no-cache
Browse files Browse the repository at this point in the history
Added no cache buildAdded make target to build without cache
  • Loading branch information
francis-nijay authored Sep 9, 2024
2 parents 9e0aab1 + eeab4a6 commit 8395544
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ build: dependencies
docker: dependencies
make -f docker.mk build-base-image docker

# Generates the docker container with no cache (but does not push)
docker-no-cache: dependencies
make -f docker.mk build-base-image docker-no-cache

# Pushes container to the repository
push: docker
make -f docker.mk push
Expand Down
8 changes: 6 additions & 2 deletions docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ endif
docker:
@echo "Base Images is set to: $(BASEIMAGE)"
@echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)"
$(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg GOPROXY --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .
$(BUILDER) build $(NOCACHE) -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg GOPROXY --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .

push:
docker-no-cache:
@echo "Building with --no-cache ..."
@make docker NOCACHE=--no-cache

push:
@echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)"
$(BUILDER) push "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)"

Expand Down

0 comments on commit 8395544

Please sign in to comment.