forked from jakubjastrabik/smartctl_ssacli_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
41 lines (34 loc) · 1.22 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ARG SSACLI_VERSION=6.15-11.0
FROM golang:1.21.1-bookworm as builder
ARG GIT_REPOSITORY
ARG SSH_DEPLOY_KEY
ARG SSACLI_VERSION
RUN \
apt-get update && \
apt-get upgrade -y && \
wget https://downloads.linux.hpe.com/SDR/repo/mcp/Debian/pool/non-free/ssacli-${SSACLI_VERSION}_amd64.deb && \
mkdir /root/.ssh/ && \
echo "${SSH_DEPLOY_KEY}" > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa && \
ssh-keyscan github.com >> /root/.ssh/known_hosts && \
git clone [email protected]:${GIT_REPOSITORY}.git app && \
cd app && \
go mod init smartctl_ssacli_exporter && \
go get && \
go build -o smartctl_ssacli_exporter
FROM debian:12.1-slim
LABEL maintainer="Patrick Baus <[email protected]>"
ARG SSACLI_VERSION
COPY --from=builder /go/app/smartctl_ssacli_exporter /sbin/smartctl_ssacli_exporter
COPY --from=builder /go/ssacli-${SSACLI_VERSION}_amd64.deb /
# Upgrade installed packages
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
smartmontools \
procps && \
dpkg -i ssacli-${SSACLI_VERSION}_amd64.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm ssacli-${SSACLI_VERSION}_amd64.deb
ENTRYPOINT ["/sbin/smartctl_ssacli_exporter"]