From ccc76bf687f0dc91f00008334c769d1f4b63ca0d Mon Sep 17 00:00:00 2001 From: shim_ Date: Mon, 13 Jun 2016 15:45:01 +0200 Subject: [PATCH] inital --- Dockerfile | 16 ++++++++++++++++ init.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile create mode 100755 init.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c67acd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine + +ENV RTM_VERSION 9.4-4 +ENV RTM_DOWNLOAD_URL "ftp://ftp.ovh.net/made-in-ovh/rtm/install_rtm-0." +ENV RTM_INSTALLER_CHECKSUM +ENV RTM_REPORT_INTERVAL 60 + +RUN apk add --no-cache bash curl sed gawk bind-tools which screen dmidecode pciutils bzip2 perl +RUN curl https://github.com/Yelp/dumb-init/releases/download/v1.0.1/dumb-init_1.0.1_amd64 > /usr/bin/dumb-init && \ + chmod +x /usr/bin/dumb-init + +COPY init.sh /usr/bin/init.sh + +VOLUME /cache + +CMD ["/usr/bin/dumb-init","/usr/bin/init.sh"] diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..30ce38a --- /dev/null +++ b/init.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +$BINARY=/usr/local/rtm/bin/rtm +$INSTALLER="/cache/install-$RTM_VERSION.sh" + +function report_loop { + while true; do + $BINARY + sleep $RTM_REPORT_INTERVAL + done +} + +if [ -f "$BINARY" ]; then + report_loop +else + curl "$RTM_DOWNLOAD_URL$RTM_VERSION" > $INSTALLER + CHECKSUM=$(sha256sum $INSTALLER) + if [ "$CHECKSUM" -eq "$RTM_INSTALLER_CHECKSUM $INSTALLER" ]; then + chmod +x $INSTALLER + $INSTALLER + report_loop + else + echo Checksum mismatch! + exit 1 + fi +fi