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

Updating dependencies to UBI micro image #169

Merged
merged 5 commits into from
Jun 12, 2024
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
7 changes: 6 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ jobs:
- name: Get dependencies
run: go mod download
- name: Build csm-metrics-powerflex Docker Image
run: make clean build docker
run: |
chmod +x ./scripts/build_ubi_micro.sh
make build-base-image
podman build -t docker.io/csm-metrics-powerflex -f ./Dockerfile --build-arg GOIMAGE=golang:latest --build-arg BASEIMAGE="localhost/mpfx-ubimicro"
podman save docker.io/library/csm-metrics-powerflex -o /tmp/csm-metrics-powerflex.tar
docker load -i /tmp/csm-metrics-powerflex.tar
- name: Run Trivy action
uses: aquasecurity/trivy-action@master
with:
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ test:
download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk

.PHONY: docker
docker: download-csm-common
.PHONY: build-base-image
build-base-image: download-csm-common
$(eval include csm-common.mk)
docker build -t csm-metrics-powerflex -f Dockerfile --build-arg BASEIMAGE=$(DEFAULT_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .
@echo "Building base image from $(DEFAULT_BASEIMAGE) and loading dependencies..."
./scripts/build_ubi_micro.sh $(DEFAULT_BASEIMAGE)
@echo "Base image build: SUCCESS"
$(eval BASEIMAGE=mpfx-ubimicro:latest)

.PHONY: docker
docker: build-base-image
docker build -t csm-metrics-powerflex -f Dockerfile --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .

.PHONY: push
push:
Expand Down
20 changes: 20 additions & 0 deletions scripts/build_ubi_micro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright © 2024 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

microcontainer=$(buildah from $1)
micromount=$(buildah mount $microcontainer)
dnf install --installroot $micromount --releasever=9 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ rpm -y
dnf clean all --installroot $micromount
buildah umount $microcontainer
buildah commit $microcontainer mpfx-ubimicro