mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
build: use BASE_IMAGE from build.env
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
f1da7d9bd1
commit
4fd973b924
8
Makefile
8
Makefile
@ -43,9 +43,7 @@ ifndef GOARCH
|
||||
GOARCH := $(shell go env GOARCH 2>/dev/null)
|
||||
endif
|
||||
|
||||
ifdef BASE_IMAGE
|
||||
BASE_IMAGE_ARG = --build-arg BASE_IMAGE=$(BASE_IMAGE)
|
||||
endif
|
||||
BASE_IMAGE ?= $(shell . $(CURDIR)/build.env ; echo $${BASE_IMAGE})
|
||||
|
||||
# passing TARGET=static-check on the 'make containerized-test' or 'make
|
||||
# containerized-build' commandline will run the selected target instead of
|
||||
@ -133,7 +131,7 @@ containerized-test: .test-container-id
|
||||
# create a (cached) container image with dependencied for building cephcsi
|
||||
.devel-container-id: scripts/Dockerfile.devel
|
||||
[ ! -f .devel-container-id ] || $(CONTAINER_CMD) rmi $(CSI_IMAGE_NAME):devel
|
||||
$(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE_NAME):devel -f ./scripts/Dockerfile.devel .
|
||||
$(CONTAINER_CMD) build $(CPUSET) --build-arg BASE_IMAGE=$(BASE_IMAGE) -t $(CSI_IMAGE_NAME):devel -f ./scripts/Dockerfile.devel .
|
||||
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):devel > .devel-container-id
|
||||
|
||||
# create a (cached) container image with dependencied for testing cephcsi
|
||||
@ -143,7 +141,7 @@ containerized-test: .test-container-id
|
||||
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
|
||||
|
||||
image-cephcsi:
|
||||
$(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --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)
|
||||
$(CONTAINER_CMD) build $(CPUSET) -t $(CSI_IMAGE) -f deploy/cephcsi/image/Dockerfile . --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) --build-arg BASE_IMAGE=$(BASE_IMAGE)
|
||||
|
||||
push-image-cephcsi: image-cephcsi
|
||||
$(CONTAINER_CMD) tag $(CSI_IMAGE) $(CSI_IMAGE)-$(GOARCH)
|
||||
|
@ -9,6 +9,9 @@
|
||||
# get proporly expanded.
|
||||
#
|
||||
|
||||
# Ceph version to use
|
||||
BASE_IMAGE=ceph/ceph:v15
|
||||
|
||||
# standard Golang options
|
||||
GOLANG_VERSION=1.13.9
|
||||
GO111MODULE=on
|
||||
|
@ -40,7 +40,7 @@ push_helm_charts() {
|
||||
}
|
||||
|
||||
# Build and push images. Steps as below:
|
||||
# 1. get base image from original Dockerfile (FROM ceph/ceph:v14.2)
|
||||
# 1. get base image from ./build.env (BASE_IMAGE=ceph/ceph:v14.2)
|
||||
# 2. parse manifest to get image digest per arch (sha256:XXX, sha256:YYY)
|
||||
# 3. patch Dockerfile with amd64 base image (FROM ceph/ceph:v14.2@sha256:XXX)
|
||||
# 4. build and push amd64 image
|
||||
@ -50,8 +50,8 @@ build_push_images() {
|
||||
# "docker manifest" requires experimental feature enabled
|
||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
|
||||
dockerfile="deploy/cephcsi/image/Dockerfile"
|
||||
baseimg=$(awk -F = '/^ARG BASE_IMAGE=/ {print $NF}' "${dockerfile}")
|
||||
build_env="build.env"
|
||||
baseimg=$(awk -F = '/^BASE_IMAGE=/ {print $NF}' "${build_env}")
|
||||
|
||||
# get image digest per architecture
|
||||
# {
|
||||
|
@ -1,6 +1,6 @@
|
||||
ARG SRC_DIR="/go/src/github.com/ceph/ceph-csi/"
|
||||
ARG GO_ARCH
|
||||
ARG BASE_IMAGE=ceph/ceph:v15
|
||||
ARG BASE_IMAGE
|
||||
|
||||
FROM ${BASE_IMAGE} as builder
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
FROM ceph/ceph:v15
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ARG GOROOT=/usr/local/go
|
||||
|
||||
|
@ -10,8 +10,8 @@ export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
cd "$(dirname "${0}")/.."
|
||||
|
||||
# ceph base image used for building multi architecture images
|
||||
dockerfile="deploy/cephcsi/image/Dockerfile"
|
||||
baseimg=$(awk -F = '/^ARG BASE_IMAGE=/ {print $NF}' "${dockerfile}")
|
||||
build_env="build.env"
|
||||
baseimg=$(awk -F = '/^BASE_IMAGE=/ {print $NF}' "${build_env}")
|
||||
|
||||
# get image digest per architecture
|
||||
# {
|
||||
|
Loading…
Reference in New Issue
Block a user