diff --git a/apps/smartctl-exporter/Dockerfile b/apps/smartctl-exporter/Dockerfile new file mode 100644 index 0000000..4752b4f --- /dev/null +++ b/apps/smartctl-exporter/Dockerfile @@ -0,0 +1,38 @@ +# syntax=docker/dockerfile:experimental + +# Use the Alpine Linux 3 base image +FROM docker.io/alpine:3.20.0 + +# Define build arguments +ARG VERSION +ARG TARGETPLATFORM +ARG TARGETARCH +ARG TARGETOS + +# Set the maintainer label +LABEL xyz.glants.image.target_platform=$TARGETPLATFORM +LABEL xyz.glants.image.target_architecture=$TARGETARCH +LABEL xyz.glants.image.target_os=$TARGETOS +LABEL org.opencontainers.image.title="smartctl-exporter" +LABEL org.opencontainers.image.source="https://github.com/prometheus-community/smartctl_exporter" +LABEL maintainer="The Prometheus Authors " + +# Install required packages +RUN apk add --no-cache smartmontools wget + +# Download and extract the smartctl_exporter binary +RUN wget -O /tmp/smartctl_exporter.tar.gz https://github.com/prometheus-community/smartctl_exporter/releases/download/v${VERSION}/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz \ + && tar -xzf /tmp/smartctl_exporter.tar.gz -C /tmp \ + && mv /tmp/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH}/smartctl_exporter /bin/smartctl_exporter \ + && chmod +x /bin/smartctl_exporter \ + && rm -r /tmp/smartctl_exporter-${VERSION}.${TARGETOS}-${TARGETARCH} /tmp/smartctl_exporter.tar.gz + + +# Expose the port for the smartctl_exporter +EXPOSE 9633 + +# Set the user to nobody +USER nobody + +# Specify the entry point for the container +ENTRYPOINT ["/bin/smartctl_exporter"] diff --git a/apps/smartctl-exporter/ci/goss.yaml b/apps/smartctl-exporter/ci/goss.yaml new file mode 100644 index 0000000..cb95f0b --- /dev/null +++ b/apps/smartctl-exporter/ci/goss.yaml @@ -0,0 +1,5 @@ +--- +# https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#process +process: + smartctl_export: + running: true diff --git a/apps/smartctl-exporter/ci/latest.py b/apps/smartctl-exporter/ci/latest.py new file mode 100644 index 0000000..fa4f61c --- /dev/null +++ b/apps/smartctl-exporter/ci/latest.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +import requests +import json + +# Get the latest version of matchbox + +URL = "https://api.github.com/repos/prometheus-community/smartctl_exporter/releases/latest" + +def get_latest(channel): + r = requests.get(URL) + data = json.loads(r.text) + version = data['tag_name'].removeprefix("v") + return version + +if __name__ == "__main__": + import sys + channel = sys.argv[1] + print(get_latest(channel)) diff --git a/apps/smartctl-exporter/metadata.yaml b/apps/smartctl-exporter/metadata.yaml new file mode 100644 index 0000000..80c065d --- /dev/null +++ b/apps/smartctl-exporter/metadata.yaml @@ -0,0 +1,13 @@ +--- +app: "smartctl-exporter" +base: false +semantic_versioning: true +channels: + - name: "stable" + platforms: + - linux/arm64 + - linux/amd64 + stable: true + tests: + enabled: true + type: web