From e3e65adc201ea6ad24aaec68af9510a9682b7eb5 Mon Sep 17 00:00:00 2001 From: Torben Nehmer Date: Thu, 8 Nov 2018 22:17:04 +0100 Subject: [PATCH] Added Build skeleton --- Dockerfile | 16 ++++++++++++++++ build-container.sh | 5 +++++ build-rootfs.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Dockerfile create mode 100755 build-container.sh create mode 100755 build-rootfs.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..64144e0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM docker:8 +LABEL maintainer="Torben Nehmer " + +RUN set -ex; \ + apt-get update; \ + \ + apt-get install -y --no-install-recommends \ + ssmtp \ + ; \ + \ + rm -rf /var/lib/apt/lists/* ;\ + apt-get clean ;\ + +# Finally, publish the rootfs file into the container +# This is done as last step to make docker build caching more efficient. +ADD rootfs.tar.gz / diff --git a/build-container.sh b/build-container.sh new file mode 100755 index 0000000..6fd549e --- /dev/null +++ b/build-container.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -ex + +docker build --force-rm -t nathan/docker8 -f Dockerfile build diff --git a/build-rootfs.sh b/build-rootfs.sh new file mode 100755 index 0000000..f02f92d --- /dev/null +++ b/build-rootfs.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -ex + +# Configuration options you usually edit go here +# CONTAINER_WEBROOT=/var/www/html + +# This is internal stuff used to build everything +# Be aware, that several of these paths are used with rm -rf! +SRCDIR=$(pwd)/src +TMPDIR=$(pwd)/tmp +BUILDDIR=$(pwd)/build +SCRIPTS_SRC=${SRCDIR}/scripts +ROOTFSTREE=${TMPDIR}/tree +ROOTFSFILE=${BUILDDIR}/rootfs.tar.gz +# WEBROOT_DST=${ROOTFSTREE}${CONTAINER_WEBROOT} + +#### Sanitize Build Enviornment +if [ -d ${TMPDIR} ]; then + rm -rf ${TMPDIR} +fi +mkdir ${TMPDIR} + +if [ -d ${BUILDDIR} ]; then + rm -rf ${BUILDDIR} +fi +mkdir ${BUILDDIR} + +#### Do the work. +# +# ... +# +# Clean up behind us +# if [ "$CLEAN_INTERMEDIATES" = true ]; then +# rm -rf ${ROUNDCUBE_SRC} +# rm -rf ${ISPCONFIG_SRC} +# fi + +#### Now we tar everything together, so that the Dockerfile can put everything in place in one run +tar -czf ${ROOTFSFILE} -C ${ROOTFSTREE} . + +# Clean up behind us +if [ "$CLEAN_INTERMEDIATES" = true ]; then + rm -rf ${ROOTFSTREE} +fi