fix(makefile): 🩹 buildx fix for pushing images

This commit is contained in:
Prashant Shahi 2022-02-09 16:00:53 +05:30
parent c5ee8cd586
commit 51b11d0119

View File

@ -38,7 +38,7 @@ build-frontend-amd64:
@echo "--> Building frontend docker image for amd64" @echo "--> Building frontend docker image for amd64"
@echo "------------------" @echo "------------------"
@cd $(FRONTEND_DIRECTORY) && \ @cd $(FRONTEND_DIRECTORY) && \
docker build -f Dockerfile --no-cache -t $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETPLATFORM="linux/amd64" docker build -f Dockerfile --no-cache -t $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) --build-arg TARGETPLATFORM="linux/amd64" .
# Step to build and push docker image of frontend(used in push pipeline) # Step to build and push docker image of frontend(used in push pipeline)
build-push-frontend: build-push-frontend:
@ -50,9 +50,7 @@ ifndef DOCKER_SECOND_TAG
docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) . docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) .
else else
@cd $(FRONTEND_DIRECTORY) && \ @cd $(FRONTEND_DIRECTORY) && \
docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 . \ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/amd64 --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) --tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_SECOND_TAG) .
--tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_TAG) \
--tag $(REPONAME)/$(FRONTEND_DOCKER_IMAGE):$(DOCKER_SECOND_TAG)
endif endif
# Steps to build and push docker image of query service # Steps to build and push docker image of query service
@ -63,9 +61,7 @@ build-query-service-amd64:
@echo "--> Building query-service docker image for amd64" @echo "--> Building query-service docker image for amd64"
@echo "------------------" @echo "------------------"
@cd $(QUERY_SERVICE_DIRECTORY) && \ @cd $(QUERY_SERVICE_DIRECTORY) && \
docker build -f Dockerfile --no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) . \ docker build -f Dockerfile --no-cache -t $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) . --build-arg TARGETPLATFORM="linux/amd64" --build-arg LD_FLAGS=$(LD_FLAGS)
--build-arg TARGETPLATFORM="linux/amd64" \
--build-arg LD_FLAGS=$(LD_FLAGS)
# Step to build and push docker image of query in amd64 and arm64 (used in push pipeline) # Step to build and push docker image of query in amd64 and arm64 (used in push pipeline)
build-push-query-service: build-push-query-service:
@ -74,17 +70,10 @@ build-push-query-service:
@echo "------------------" @echo "------------------"
ifndef DOCKER_SECOND_TAG ifndef DOCKER_SECOND_TAG
@cd $(QUERY_SERVICE_DIRECTORY) && \ @cd $(QUERY_SERVICE_DIRECTORY) && \
docker buildx build --file Dockerfile --progress plane --no-cache --push \ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS=$(LD_FLAGS) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) .
--platform linux/arm64,linux/amd64 . \
--build-arg LD_FLAGS=$(LD_FLAGS) \
--tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG)
else else
@cd $(QUERY_SERVICE_DIRECTORY) && \ @cd $(QUERY_SERVICE_DIRECTORY) && \
docker buildx build --file Dockerfile --progress plane --no-cache \ docker buildx build --file Dockerfile --progress plane --no-cache --push --platform linux/arm64,linux/amd64 --build-arg LD_FLAGS=$(LD_FLAGS) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) --tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_SECOND_TAG) .
--push --platform linux/arm64,linux/amd64 . \
--build-arg LD_FLAGS=$(LD_FLAGS) \
--tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_TAG) \
--tag $(REPONAME)/$(QUERY_SERVICE_DOCKER_IMAGE):$(DOCKER_SECOND_TAG)
endif endif
# Steps to build and push docker image of flattener # Steps to build and push docker image of flattener