mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
Update makefile and deploy.sh to pass build arguments
updated makefile to pass the required build arguments for multistage docker build Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
2de2d348c1
commit
4b540ffecc
6
Makefile
6
Makefile
@ -21,7 +21,7 @@ CSI_IMAGE_VERSION=$(if $(ENV_CSI_IMAGE_VERSION),$(ENV_CSI_IMAGE_VERSION),canary)
|
|||||||
CSI_IMAGE=$(CSI_IMAGE_NAME):$(CSI_IMAGE_VERSION)
|
CSI_IMAGE=$(CSI_IMAGE_NAME):$(CSI_IMAGE_VERSION)
|
||||||
|
|
||||||
$(info cephcsi image settings: $(CSI_IMAGE_NAME) version $(CSI_IMAGE_VERSION))
|
$(info cephcsi image settings: $(CSI_IMAGE_NAME) version $(CSI_IMAGE_VERSION))
|
||||||
ifeq ($(origin GIT_COMMIT), undefined)
|
ifndef GIT_COMMIT
|
||||||
GIT_COMMIT=$(shell git rev-list -1 HEAD)
|
GIT_COMMIT=$(shell git rev-list -1 HEAD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ LDFLAGS += -X $(GO_PROJECT)/pkg/util.GitCommit=$(GIT_COMMIT)
|
|||||||
LDFLAGS += -X $(GO_PROJECT)/pkg/util.DriverVersion=$(CSI_IMAGE_VERSION)
|
LDFLAGS += -X $(GO_PROJECT)/pkg/util.DriverVersion=$(CSI_IMAGE_VERSION)
|
||||||
|
|
||||||
# set GOARCH explicitly for cross building, default to native architecture
|
# set GOARCH explicitly for cross building, default to native architecture
|
||||||
ifeq ($(origin GOARCH), undefined)
|
ifndef GOARCH
|
||||||
GOARCH := $(shell go env GOARCH)
|
GOARCH := $(shell go env GOARCH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ containerized-test: .test-container-id
|
|||||||
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
|
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
|
||||||
|
|
||||||
image-cephcsi:
|
image-cephcsi:
|
||||||
$(CONTAINER_CMD) build -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --build-arg GOLANG_VERSION=1.13.8 --build-arg CSI_IMAGE_NAME=$(CSI_IMAGE_NAME) --build-arg CSI_IMAGE_VERSION=$(CSI_IMAGE_VERSION) --build-arg GIT_COMMIT=$(shell git rev-list -1 HEAD) --build-arg ARCH=$(ARCH)
|
$(CONTAINER_CMD) build -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --build-arg GOLANG_VERSION=1.13.8 --build-arg CSI_IMAGE_NAME=$(CSI_IMAGE_NAME) --build-arg CSI_IMAGE_VERSION=$(CSI_IMAGE_VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) --build-arg GO_ARCH=$(GOARCH)
|
||||||
|
|
||||||
push-image-cephcsi: image-cephcsi
|
push-image-cephcsi: image-cephcsi
|
||||||
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)
|
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)
|
||||||
|
@ -67,7 +67,7 @@ build_push_images() {
|
|||||||
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
|
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
|
||||||
IFS=$ifs
|
IFS=$ifs
|
||||||
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
|
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
|
||||||
ARCH=${ARCH} make push-image-cephcsi
|
GOARCH=${ARCH} make push-image-cephcsi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user