From 86a786a0370e7aeec6aaade22e86dc3f9c3fd4df Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Mon, 2 Mar 2015 16:03:51 +0100 Subject: [PATCH] use s6-builder manifest.txt to identify which versions should be included --- Dockerfile | 62 ++----------- .../etc/fix-attrs.d/00-base | 0 .../etc/s6/.s6-init/init-stage1 | 0 .../etc/s6/.s6-init/init-stage2 | 0 .../etc/s6/.s6-init/init-stage3 | 0 .../etc/s6/.s6-svscan/crash | 0 .../etc/s6/.s6-svscan/finish | 0 .../etc/s6/fdholderd/rules/uid/default/allow | 0 .../rules/uid/default/env/S6_FDHOLDER_LIST | 0 .../default/env/S6_FDHOLDER_RETRIEVE_REGEX | 0 .../uid/default/env/S6_FDHOLDER_STORE_REGEX | 0 .../etc/s6/fdholderd/run | 0 {rootfs => overlay-rootfs}/init | 0 .../usr/bin/with-contenv | 0 .../usr/bin/with-notifywhenup | 0 rootfs/build-latest | 87 +++++++++++++++++++ 16 files changed, 95 insertions(+), 54 deletions(-) rename {rootfs => overlay-rootfs}/etc/fix-attrs.d/00-base (100%) rename {rootfs => overlay-rootfs}/etc/s6/.s6-init/init-stage1 (100%) rename {rootfs => overlay-rootfs}/etc/s6/.s6-init/init-stage2 (100%) rename {rootfs => overlay-rootfs}/etc/s6/.s6-init/init-stage3 (100%) rename {rootfs => overlay-rootfs}/etc/s6/.s6-svscan/crash (100%) rename {rootfs => overlay-rootfs}/etc/s6/.s6-svscan/finish (100%) rename {rootfs => overlay-rootfs}/etc/s6/fdholderd/rules/uid/default/allow (100%) rename {rootfs => overlay-rootfs}/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_LIST (100%) rename {rootfs => overlay-rootfs}/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_RETRIEVE_REGEX (100%) rename {rootfs => overlay-rootfs}/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_STORE_REGEX (100%) rename {rootfs => overlay-rootfs}/etc/s6/fdholderd/run (100%) rename {rootfs => overlay-rootfs}/init (100%) rename {rootfs => overlay-rootfs}/usr/bin/with-contenv (100%) rename {rootfs => overlay-rootfs}/usr/bin/with-notifywhenup (100%) create mode 100644 rootfs/build-latest diff --git a/Dockerfile b/Dockerfile index 3f38397..3caa0d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,60 +1,14 @@ FROM ubuntu:14.04 MAINTAINER Gorka Lerchundi Osa -## -## VERSION -## +ENV LC_ALL C +ENV DEBIAN_FRONTEND noninteractive -ENV RELEASE_VERSION 1.3.0 +RUN apt-get update && apt-get install -y curl +COPY rootfs / +RUN chmod +x /build-latest -## -## OVERLAY -## +ENV OVERLAY_ROOTFS_PATH /overlay-rootfs +COPY overlay-rootfs $OVERLAY_ROOTFS_PATH -ENV ROOTFS_PATH /rootfs - -# root filesystem -COPY rootfs $ROOTFS_PATH - -# fix-attrs -ADD https://github.com/glerchundi/fix-attrs/releases/download/v0.4.0/fix-attrs-0.4.0-linux-amd64 $ROOTFS_PATH/usr/bin/fix-attrs - -# execline -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/execline-2.1.0.0-linux-amd64-bin.tar.gz /tmp/execline.tar.gz -RUN tar xvfz /tmp/execline.tar.gz -C $ROOTFS_PATH - -# s6 -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-2.1.1.2-linux-amd64-bin.tar.gz /tmp/s6.tar.gz -RUN tar xvfz /tmp/s6.tar.gz -C $ROOTFS_PATH - -# s6-portable-utils -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-portable-utils-2.0.0.1-linux-amd64-bin.tar.gz /tmp/s6-portable-utils.tar.gz -RUN tar xvfz /tmp/s6-portable-utils.tar.gz -C $ROOTFS_PATH - -# s6-linux-utils -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-linux-utils-2.0.1.0-linux-amd64-bin.tar.gz /tmp/s6-linux-utils.tar.gz -RUN tar xvfz /tmp/s6-linux-utils.tar.gz -C $ROOTFS_PATH - -# s6-dns -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-dns-2.0.0.2-linux-amd64-bin.tar.gz /tmp/s6-dns.tar.gz -RUN tar xvfz /tmp/s6-dns.tar.gz -C $ROOTFS_PATH - -# s6-networking -ADD https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-networking-2.1.0.0-linux-amd64-bin.tar.gz /tmp/s6-networking.tar.gz -RUN tar xvfz /tmp/s6-networking.tar.gz -C $ROOTFS_PATH - -## -## FIX PERMS -## - -RUN chmod +x $ROOTFS_PATH/init \ - $ROOTFS_PATH/etc/s6/.s6-svscan/finish \ - $ROOTFS_PATH/etc/s6/.s6-init/init-stage* \ - $ROOTFS_PATH/usr/bin/fix-attrs - -## -## RUN & DIST! -## - -RUN mkdir -p /dist -CMD [ "tar", "-zcvf", "/dist/s6-overlay-$RELEASE_VERSION-linux-amd64.tar.gz", "-C", "/rootfs", "./" ] +ENTRYPOINT [ "/build-latest" ] diff --git a/rootfs/etc/fix-attrs.d/00-base b/overlay-rootfs/etc/fix-attrs.d/00-base similarity index 100% rename from rootfs/etc/fix-attrs.d/00-base rename to overlay-rootfs/etc/fix-attrs.d/00-base diff --git a/rootfs/etc/s6/.s6-init/init-stage1 b/overlay-rootfs/etc/s6/.s6-init/init-stage1 similarity index 100% rename from rootfs/etc/s6/.s6-init/init-stage1 rename to overlay-rootfs/etc/s6/.s6-init/init-stage1 diff --git a/rootfs/etc/s6/.s6-init/init-stage2 b/overlay-rootfs/etc/s6/.s6-init/init-stage2 similarity index 100% rename from rootfs/etc/s6/.s6-init/init-stage2 rename to overlay-rootfs/etc/s6/.s6-init/init-stage2 diff --git a/rootfs/etc/s6/.s6-init/init-stage3 b/overlay-rootfs/etc/s6/.s6-init/init-stage3 similarity index 100% rename from rootfs/etc/s6/.s6-init/init-stage3 rename to overlay-rootfs/etc/s6/.s6-init/init-stage3 diff --git a/rootfs/etc/s6/.s6-svscan/crash b/overlay-rootfs/etc/s6/.s6-svscan/crash similarity index 100% rename from rootfs/etc/s6/.s6-svscan/crash rename to overlay-rootfs/etc/s6/.s6-svscan/crash diff --git a/rootfs/etc/s6/.s6-svscan/finish b/overlay-rootfs/etc/s6/.s6-svscan/finish similarity index 100% rename from rootfs/etc/s6/.s6-svscan/finish rename to overlay-rootfs/etc/s6/.s6-svscan/finish diff --git a/rootfs/etc/s6/fdholderd/rules/uid/default/allow b/overlay-rootfs/etc/s6/fdholderd/rules/uid/default/allow similarity index 100% rename from rootfs/etc/s6/fdholderd/rules/uid/default/allow rename to overlay-rootfs/etc/s6/fdholderd/rules/uid/default/allow diff --git a/rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_LIST b/overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_LIST similarity index 100% rename from rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_LIST rename to overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_LIST diff --git a/rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_RETRIEVE_REGEX b/overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_RETRIEVE_REGEX similarity index 100% rename from rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_RETRIEVE_REGEX rename to overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_RETRIEVE_REGEX diff --git a/rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_STORE_REGEX b/overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_STORE_REGEX similarity index 100% rename from rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_STORE_REGEX rename to overlay-rootfs/etc/s6/fdholderd/rules/uid/default/env/S6_FDHOLDER_STORE_REGEX diff --git a/rootfs/etc/s6/fdholderd/run b/overlay-rootfs/etc/s6/fdholderd/run similarity index 100% rename from rootfs/etc/s6/fdholderd/run rename to overlay-rootfs/etc/s6/fdholderd/run diff --git a/rootfs/init b/overlay-rootfs/init similarity index 100% rename from rootfs/init rename to overlay-rootfs/init diff --git a/rootfs/usr/bin/with-contenv b/overlay-rootfs/usr/bin/with-contenv similarity index 100% rename from rootfs/usr/bin/with-contenv rename to overlay-rootfs/usr/bin/with-contenv diff --git a/rootfs/usr/bin/with-notifywhenup b/overlay-rootfs/usr/bin/with-notifywhenup similarity index 100% rename from rootfs/usr/bin/with-notifywhenup rename to overlay-rootfs/usr/bin/with-notifywhenup diff --git a/rootfs/build-latest b/rootfs/build-latest new file mode 100644 index 0000000..689d475 --- /dev/null +++ b/rootfs/build-latest @@ -0,0 +1,87 @@ +#!/bin/bash + +## +## PARAMS +## + +OVERLAY_ROOTFS_PATH=${1:-/overlay-rootfs} +RELEASE_VERSION=${2:-1.3.0} + +## +## OVERLAY +## + +# create overlay folder +mkdir -p $OVERLAY_ROOTFS_PATH + +# fix-attrs +curl -R -L \ + -o $OVERLAY_ROOTFS_PATH/usr/bin/fix-attrs \ + https://github.com/glerchundi/fix-attrs/releases/download/v0.4.0/fix-attrs-0.4.0-linux-amd64 + +# skarnet versions manifest +curl -R -L \ + -o /tmp/manifest.txt \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/manifest.txt + +# parse manifest into s6 associative array +declare -A versions +while read -r line +do + key=`echo "${line}" | cut -d"=" -f1` + value=`echo "${line}" | cut -d"=" -f2` + if [[ ! -z "${key}" && ! -z "${value}" ]]; then + versions[${key}]=${value} + fi +done < /tmp/manifest.txt + +# execline +curl -R -L \ + -o /tmp/execline.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/execline-${versions[execline]}-linux-amd64-bin.tar.gz +tar xvfz /tmp/execline.tar.gz -C $OVERLAY_ROOTFS_PATH + +# s6 +curl -R -L \ + -o /tmp/s6.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-${versions[s6]}-linux-amd64-bin.tar.gz +tar xvfz /tmp/s6.tar.gz -C $OVERLAY_ROOTFS_PATH + +# s6-portable-utils +curl -R -L \ + -o /tmp/s6-portable-utils.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-portable-utils-${versions[s6-portable-utils]}-linux-amd64-bin.tar.gz + +# s6-linux-utils +curl -R -L \ + -o /tmp/s6-linux-utils.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-linux-utils-${versions[s6-linux-utils]}-linux-amd64-bin.tar.gz +tar xvfz /tmp/s6-linux-utils.tar.gz -C $OVERLAY_ROOTFS_PATH + +# s6-dns +curl -R -L \ + -o /tmp/s6-dns.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-dns-${versions[s6-dns]}-linux-amd64-bin.tar.gz +tar xvfz /tmp/s6-dns.tar.gz -C $OVERLAY_ROOTFS_PATH + +# s6-networking +curl -R -L \ + -o /tmp/s6-networking.tar.gz \ + https://github.com/glerchundi/container-s6-builder/releases/download/v$RELEASE_VERSION/s6-networking-${versions[s6-networking]}-linux-amd64-bin.tar.gz +tar xvfz /tmp/s6-networking.tar.gz -C $OVERLAY_ROOTFS_PATH + +## +## FIX PERMS +## + +chmod +x $OVERLAY_ROOTFS_PATH/init \ + $OVERLAY_ROOTFS_PATH/etc/s6/.s6-svscan/finish \ + $OVERLAY_ROOTFS_PATH/etc/s6/.s6-init/init-stage* \ + $OVERLAY_ROOTFS_PATH/usr/bin/fix-attrs + +## +## DIST! +## + +mkdir -p /dist +tar -zcvf /dist/s6-overlay-$RELEASE_VERSION-linux-amd64.tar.gz -C $OVERLAY_ROOTFS_PATH ./