Added Build skeleton

This commit is contained in:
Torben Nehmer 2018-11-08 22:17:04 +01:00
parent e3ec77e02e
commit e3e65adc20
3 changed files with 66 additions and 0 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM docker:8
LABEL maintainer="Torben Nehmer <torben@nehmer.net>"
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 /

5
build-container.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -ex
docker build --force-rm -t nathan/docker8 -f Dockerfile build

45
build-rootfs.sh Executable file
View File

@ -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