Skip to content

Commit

Permalink
update base image (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjiang27 authored Jun 12, 2024
1 parent 5f3839f commit 8053981
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
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

0 comments on commit 8053981

Please sign in to comment.