mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
Read baseimage from the dockerfile
Updated deploy.sh and build scripts to read base image from the dockerfile Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
697ed32778
commit
bfa6064b4d
6
Makefile
6
Makefile
@ -38,6 +38,10 @@ ifndef GOARCH
|
||||
GOARCH := $(shell go env GOARCH)
|
||||
endif
|
||||
|
||||
ifdef BASE_IMAGE
|
||||
BASE_IMAGE_ARG = --build-arg BASE_IMAGE=$(BASE_IMAGE)
|
||||
endif
|
||||
|
||||
SELINUX := $(shell getenforce 2>/dev/null)
|
||||
ifeq ($(SELINUX),Enforcing)
|
||||
SELINUX_VOL_FLAG = :z
|
||||
@ -93,7 +97,7 @@ containerized-test: .test-container-id
|
||||
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
|
||||
|
||||
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=$(GIT_COMMIT) --build-arg GO_ARCH=$(GOARCH)
|
||||
$(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) $(BASE_IMAGE_ARG)
|
||||
|
||||
push-image-cephcsi: image-cephcsi
|
||||
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)
|
||||
|
@ -26,6 +26,6 @@ for ARCH in amd64 arm64; do
|
||||
IFS=
|
||||
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
|
||||
IFS=$ifs
|
||||
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
|
||||
GOARCH=${ARCH} make image-cephcsi
|
||||
base_img=${baseimg}@${digest}
|
||||
GOARCH=${ARCH} BASE_IMAGE=${base_img} make image-cephcsi
|
||||
done
|
||||
|
@ -67,8 +67,8 @@ build_push_images() {
|
||||
IFS=
|
||||
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
|
||||
IFS=$ifs
|
||||
sed -i "s|\(^FROM.*\)${baseimg}.*$|\1${baseimg}@${digest}|" "${dockerfile}"
|
||||
GOARCH=${ARCH} make push-image-cephcsi
|
||||
base_image=${baseimg}@${digest}
|
||||
GOARCH=${ARCH} BASE_IMAGE=${base_image} make push-image-cephcsi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
ARG SRC_DIR="/go/src/github.com/ceph/ceph-csi/"
|
||||
ARG GO_ARCH
|
||||
FROM ceph/ceph:v15
|
||||
ARG BASE_IMAGE=ceph/ceph:v15
|
||||
|
||||
FROM ${BASE_IMAGE} as builder
|
||||
|
||||
LABEL stage="build"
|
||||
|
||||
@ -35,7 +37,7 @@ COPY . ${SRC_DIR}
|
||||
RUN make cephcsi
|
||||
|
||||
#-- Final container
|
||||
FROM ceph/ceph:v15
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ARG SRC_DIR
|
||||
|
||||
@ -44,6 +46,6 @@ LABEL maintainers="Ceph-CSI Authors" \
|
||||
architecture=${GO_ARCH} \
|
||||
description="Ceph-CSI Plugin"
|
||||
|
||||
COPY --from=0 ${SRC_DIR}/_output/cephcsi /usr/local/bin/cephcsi
|
||||
COPY --from=builder ${SRC_DIR}/_output/cephcsi /usr/local/bin/cephcsi
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/cephcsi"]
|
||||
|
Loading…
Reference in New Issue
Block a user