diff options
| author | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-08-30 13:09:56 -0600 |
|---|---|---|
| committer | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-08-30 13:09:56 -0600 |
| commit | 649f0dd9c5ca586d8b637400dd19c0c4059447d6 (patch) | |
| tree | 5ccc992a3aa5de1bcb510911dfdb21e6a54bd197 /salt/openbook/baseimage | |
initial commit
Diffstat (limited to 'salt/openbook/baseimage')
| -rw-r--r-- | salt/openbook/baseimage/files/Dockerfile | 4 | ||||
| -rw-r--r-- | salt/openbook/baseimage/files/build.sh | 31 | ||||
| -rw-r--r-- | salt/openbook/baseimage/files/installdeps.sh | 7 | ||||
| -rw-r--r-- | salt/openbook/baseimage/files/sources.list | 54 | ||||
| -rw-r--r-- | salt/openbook/baseimage/init.sls | 30 |
5 files changed, 126 insertions, 0 deletions
diff --git a/salt/openbook/baseimage/files/Dockerfile b/salt/openbook/baseimage/files/Dockerfile new file mode 100644 index 0000000..1c02714 --- /dev/null +++ b/salt/openbook/baseimage/files/Dockerfile @@ -0,0 +1,4 @@ +FROM ubuntu:xenial +MAINTAINER Carlos Konstanski <carlos@talligent.com> +ADD docker-start.tar.xz / +RUN /installdeps.sh diff --git a/salt/openbook/baseimage/files/build.sh b/salt/openbook/baseimage/files/build.sh new file mode 100644 index 0000000..d5cad7a --- /dev/null +++ b/salt/openbook/baseimage/files/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Do not call directly. Meant to be called from CI build script. + +pushd {{ pillar["baseimage"]["build_dir"] }} 2>/dev/null + +echo "Creating tmp directory" +rm -rf tmp +mkdir tmp +rm -f docker-start.tar.xz + +echo "Populating with custom files" +rsync -aq data/ tmp/ + +echo "Repackaging into .xz file" +tar Jcvf docker-start.tar.xz -C tmp/ . + +echo "Deleting existing docker container" +docker stop {{ pillar["baseimage"]["container_name"] }} +docker container prune -f +docker rmi -f {{ pillar["baseimage"]["image_name"] }} + +echo "Building docker Ubuntu image" +docker build -t {{ pillar["baseimage"]["image_name"] }} . + +echo "Cleaning up" +rm -rf tmp +rm -f docker-start.tar.xz + +popd 2>/dev/null +exit 0 diff --git a/salt/openbook/baseimage/files/installdeps.sh b/salt/openbook/baseimage/files/installdeps.sh new file mode 100644 index 0000000..1bcccdb --- /dev/null +++ b/salt/openbook/baseimage/files/installdeps.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python +exit 0 diff --git a/salt/openbook/baseimage/files/sources.list b/salt/openbook/baseimage/files/sources.list new file mode 100644 index 0000000..4e624e5 --- /dev/null +++ b/salt/openbook/baseimage/files/sources.list @@ -0,0 +1,54 @@ +# deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted + +# deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted +# deb http://security.ubuntu.com/ubuntu xenial-security main restricted + +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. +deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial main restricted + +## Major bug fix updates produced after the final release of the +## distribution. +deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team. Also, please note that software in universe WILL NOT receive any +## review or updates from the Ubuntu security team. +deb http://de.archive.ubuntu.com/ubuntu/ xenial universe +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial universe +deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team, and may not be under a free licence. Please satisfy yourself as to +## your rights to use the software. Also, please note that software in +## multiverse WILL NOT receive any review or updates from the Ubuntu +## security team. +deb http://de.archive.ubuntu.com/ubuntu/ xenial multiverse +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse +deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse + +## N.B. software from this repository may not have been tested as +## extensively as that contained in the main release, although it includes +## newer versions of some applications which may provide useful features. +## Also, please note that software in backports WILL NOT receive any review +## or updates from the Ubuntu security team. +deb http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse +# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse + +## Uncomment the following two lines to add software from Canonical's +## 'partner' repository. +## This software is not part of Ubuntu, but is offered by Canonical and the +## respective vendors as a service to Ubuntu users. +# deb http://archive.canonical.com/ubuntu xenial partner +# deb-src http://archive.canonical.com/ubuntu xenial partner + +deb http://security.ubuntu.com/ubuntu xenial-security main restricted +# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted +deb http://security.ubuntu.com/ubuntu xenial-security universe +# deb-src http://security.ubuntu.com/ubuntu xenial-security universe +deb http://security.ubuntu.com/ubuntu xenial-security multiverse +# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse diff --git a/salt/openbook/baseimage/init.sls b/salt/openbook/baseimage/init.sls new file mode 100644 index 0000000..f23989d --- /dev/null +++ b/salt/openbook/baseimage/init.sls @@ -0,0 +1,30 @@ +{% for dir in pillar["baseimage"]["dirs"].items() %} +baseimage_dirs_{{ dir[0] }}: + file.directory: +{% if dir[1]["relative_to_data"] %} + - name: {{ pillar["baseimage"]["build_dir"] }}/{{ dir[1]["name"] }} +{% else %} + - name: {{ dir[1]["name"] }} +{% endif %} + - user: root + - group: root + - mode: {{ dir[1]["mode"] }} + - makedirs: True +{% endfor %} + +{% for file in pillar["baseimage"]["files"].items() %} +baseimage_files_{{ file[0] }}: + file.managed: +{% if file[1]["relative_to_data"] %} + - name: {{ pillar["baseimage"]["build_dir"] }}/{{ file[1]["name"] }} +{% else %} + - name: {{ file[1]["name"] }} +{% endif %} + - source: salt://openbook/baseimage/files/{{ file[1]["source"] }} +{% if file[1]["is_template"] %} + - template: jinja +{% endif %} + - user: root + - group: root + - mode: {{ file[1]["mode"] }} +{% endfor %} |
