Skip to content

Commit

Permalink
update base image (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjiang27 authored Jun 12, 2024
1 parent 720c4e5 commit ee7d6de
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 @@ -73,7 +73,12 @@ jobs:
- name: Get dependencies
run: go mod download
- name: Build csm-metrics-powerstore 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-powerstore -f ./Dockerfile --build-arg GOIMAGE=golang:latest --build-arg BASEIMAGE="localhost/mpst-ubimicro"
podman save docker.io/library/csm-metrics-powerstore -o /tmp/csm-metrics-powerstore.tar
docker load -i /tmp/csm-metrics-powerstore.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 @@ -29,10 +29,17 @@ generate:
test:
go test -count=1 -cover -race -timeout 30s -short ./...

.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-powerstore -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=mpst-ubimicro:latest)

.PHONY: docker
docker: build-base-image
docker build -t csm-metrics-powerstore -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 mpst-ubimicro

0 comments on commit ee7d6de

Please sign in to comment.