Skip to content

Added no cache buildAdded make target to build without cache #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading