Skip to content

Commit

Permalink
use s6-builder manifest.txt to identify which versions should be incl…
Browse files Browse the repository at this point in the history
…uded
  • Loading branch information
glerchundi committed Mar 2, 2015
1 parent faf7403 commit 86a786a
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 54 deletions.
62 changes: 8 additions & 54 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,14 @@
FROM ubuntu:14.04
MAINTAINER Gorka Lerchundi Osa <[email protected]>

##
## 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" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions rootfs/build-latest
Original file line number Diff line number Diff line change
@@ -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 ./

0 comments on commit 86a786a

Please sign in to comment.