Skip to content

Commit

Permalink
Add SUM and IPMI tools. (#28)
Browse files Browse the repository at this point in the history
* Add SUM and IPMI tools.

- Replace alpine with debian, since the sum tool is a dynamic linked library, and even alpines gcompat doesn't contain mallopt, which SUM needs.
- Build ipmitool from scratch to get cherry picked bug fixes.

* reduce image size by 500MB

* fix lint issue

* revert dynamic link of go binary

* predownload iana resource to reduce dependencies on 3rd party servers
  • Loading branch information
jakeschuurmans authored Nov 4, 2024
1 parent 0328f6d commit 915e795
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
71 changes: 70 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,73 @@
FROM alpine:latest
FROM debian:12.5-slim AS stage1

# Supermicro SUM
# Note: If we remove the SUM tool, we can move back to an alpine image. Then also compile bioscfg with CGO_ENABLED=0
WORKDIR /tmp/sum

## Pre-reqs
RUN apt-get update
RUN apt-get install wget -y

## Download
RUN wget https://www.supermicro.com/Bios/sw_download/698/sum_2.14.0_Linux_x86_64_20240215.tar.gz -O sum.tar.gz
RUN mkdir -p unzipped
RUN tar -xvzf sum.tar.gz -C unzipped --strip-components=1

## Install
RUN cp unzipped/sum /usr/sbin/sum #TODO; smc sum has the same name as the gnu command sum (/usr/bin/sum). So we are overwritting it. Sorry not Sorry.
RUN chmod +x /usr/sbin/sum

# IPMI Tool
#
# cherry-pick'ed 1edb0e27e44196d1ebe449aba0b9be22d376bcb6
# to fix https://github.com/ipmitool/ipmitool/issues/377
#
ARG IPMITOOL_REPO=https://github.com/ipmitool/ipmitool.git
ARG IPMITOOL_COMMIT=19d78782d795d0cf4ceefe655f616210c9143e62
ARG IPMITOOL_CHERRY_PICK=1edb0e27e44196d1ebe449aba0b9be22d376bcb6
ARG IPMITOOL_BUILD_DEPENDENCIES="git curl make autoconf automake libtool libreadline-dev"

WORKDIR /tmp/ipmi

## Pre-reqs
RUN apt-get update
RUN apt-get install ${IPMITOOL_BUILD_DEPENDENCIES} -y

## Download
RUN git clone -b master ${IPMITOOL_REPO}
WORKDIR /tmp/ipmi/ipmitool
RUN git checkout ${IPMITOOL_COMMIT}
RUN git config --global user.email "[email protected]"
RUN git cherry-pick ${IPMITOOL_CHERRY_PICK}

## Install
RUN ./bootstrap
RUN autoreconf -i
RUN ./configure \
--prefix=/usr/local \
--enable-ipmievd \
--enable-ipmishell \
--enable-intf-lan \
--enable-intf-lanplus \
--enable-intf-open
RUN make
RUN make install

## Get IPMI IANA resource, to prevent dependency on third party servers at runtime.
WORKDIR /usr/share/misc
RUN wget https://www.iana.org/assignments/enterprise-numbers.txt

# Build a lean image with dependencies installed.
FROM debian:12.5-slim
COPY --from=stage1 /usr/sbin/sum /usr/bin/sum
COPY --from=stage1 /usr/local/bin/ipmitool /usr/local/bin/ipmitool
COPY --from=stage1 /usr/share/misc/enterprise-numbers.txt /usr/share/misc/enterprise-numbers.txt

## Install runtime dependencies
RUN apt-get update -y
RUN apt-get install libreadline8 --no-install-recommends -y

# BiosCfg

COPY bioscfg /usr/sbin/bioscfg
RUN chmod +x /usr/sbin/bioscfg
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ build-linux:
ifeq ($(GO_VERSION), 0)
$(error build requies go version 1.22 or higher)
endif
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bioscfg \
CGO_ENABLED=0 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bioscfg \
-ldflags \
"-X $(LDFLAG_LOCATION).GitCommit=$(GIT_COMMIT) \
-X $(LDFLAG_LOCATION).GitBranch=$(GIT_BRANCH) \
Expand Down

0 comments on commit 915e795

Please sign in to comment.