Skip to content
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

Migrate from ubi-minimal redhat base image to ubi-micro #203

Merged
merged 7 commits into from
May 30, 2023
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
12 changes: 1 addition & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@ RUN CGO_ENABLED=0 \
make build

# Stage to build the driver image
FROM $BASEIMAGE@${DIGEST} AS final
# install necessary packages
# alphabetical order for easier maintenance
RUN microdnf update -y && \
microdnf install -y \
e4fsprogs \
kmod \
libaio \
numactl \
xfsprogs && \
microdnf clean all
FROM $BASEIMAGE AS final
ENTRYPOINT ["/csi-vxflexos.sh"]
# copy in the driver
COPY --from=builder /go/src/csi-vxflexos /
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ build: dependencies

# Generates the docker container (but does not push)
docker: dependencies
make -f docker.mk docker
make -f docker.mk build-base-image docker

# Pushes container to the repository
push: docker
Expand Down
8 changes: 7 additions & 1 deletion docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ 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 GOVERSION=$(GOVERSION) --build-arg DIGEST=$(DIGEST) .
$(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg GOPROXY --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOVERSION=$(GOVERSION) .

push:
@echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)"
$(BUILDER) push "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)"

build-base-image:
@echo "Building base image from $(BASEIMAGE) and loading dependencies..."
./scripts/build_ubi_micro.sh $(BASEIMAGE)
@echo "Base image build: SUCCESS"
$(eval BASEIMAGE=localhost/csipowerflex-ubimicro:latest)
10 changes: 1 addition & 9 deletions overrides.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#

# DEFAULT values
DEFAULT_BASEIMAGE="registry.access.redhat.com/ubi8/ubi-minimal"
# digest for 8.7-1085
DEFAULT_DIGEST="sha256:ab03679e683010d485ef0399e056b09a38d7843ba4a36ee7dec337dd0037f7a7"
DEFAULT_BASEIMAGE="registry.access.redhat.com/ubi8/ubi-micro:8.7-8"
DEFAULT_GOVERSION="1.20"
DEFAULT_REGISTRY="sample_registry"
DEFAULT_IMAGENAME="csi-vxflexos"
Expand All @@ -17,10 +15,6 @@ ifeq ($(BASEIMAGE),)
export BASEIMAGE="$(DEFAULT_BASEIMAGE)"
endif

# set the IMAGEDIGEST if needed
ifeq ($(DIGEST),)
export DIGEST="$(DEFAULT_DIGEST)"
endif

# set the GOVERSION if needed
ifeq ($(GOVERSION),)
Expand Down Expand Up @@ -63,8 +57,6 @@ overrides-help:
@echo " Current setting is: $(GOVERSION)"
@echo "BASEIMAGE - The base container image to build from, default is: $(DEFAULT_BASEIMAGE)"
@echo " Current setting is: $(BASEIMAGE)"
@echo "IMAGEDIGEST - The digest of baseimage, default is: $(DEFAULT_DIGEST)"
@echo " Current setting is: $(DIGEST)"
@echo "REGISTRY - The registry to push images to, default is: $(DEFAULT_REGISTRY)"
@echo " Current setting is: $(REGISTRY)"
@echo "IMAGENAME - The image name to be built, defaut is: $(DEFAULT_IMAGENAME)"
Expand Down
7 changes: 7 additions & 0 deletions scripts/build_ubi_micro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
microcontainer=$(buildah from $1)
micromount=$(buildah mount $microcontainer)
dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ e4fsprogs xfsprogs libaio kmod numactl util-linux -y
dnf clean all --installroot $micromount
buildah umount $microcontainer
buildah commit $microcontainer csipowerflex-ubimicro