diff options
-rw-r--r-- | adei-mini/Dockerfile | 44 | ||||
-rw-r--r-- | adei-mini/Makefile | 20 | ||||
-rwxr-xr-x | adei-mini/files/docker-entrypoint.sh | 14 | ||||
-rwxr-xr-x | adei-mini/files/openshift-entrypoint.sh | 17 | ||||
-rw-r--r-- | docker-compose.yml | 12 | ||||
-rw-r--r-- | kiwi/Makefile | 19 | ||||
-rw-r--r-- | kiwi/adei/Dicefile | 3 | ||||
-rw-r--r-- | kiwi/adei/config.sh | 105 | ||||
-rw-r--r-- | kiwi/adei/config.xml | 54 | ||||
-rw-r--r-- | kiwi/adei/config.xml.save | 41 |
10 files changed, 329 insertions, 0 deletions
diff --git a/adei-mini/Dockerfile b/adei-mini/Dockerfile new file mode 100644 index 0000000..4845c18 --- /dev/null +++ b/adei-mini/Dockerfile @@ -0,0 +1,44 @@ +FROM chsa/microadei:latest +MAINTAINER Suren A. Chilingaryan <csa@suren.me> + +VOLUME /adei + +ENV ADEI_REVISION=last:1 \ + ADEI_PARALLEL=sources \ + ADEI_SETUP=all \ + ADEI_ENABLED_SETUPS="autogen logs" \ + ADEI_PORTS=80 \ + APACHE_SERVERS=0 \ + MYSQL_SERVER=adei-mysql \ + MYSQL_PORT=3306 \ + MYSQL_USER=adei \ + MYSQL_PASSWORD=adei \ + MYSQL_DATABASE=adei \ + LANG=en_US.UTF-8 \ + LANGUAGE=en_US:en \ + LC_ALL=en_US.UTF-8 + +COPY files/ / + +RUN bash -c 'mkdir -p /adei/{src,cfg,tmp,sys,log,mail}' && \ + \ +# Replace packaged ADEI with repository version + mkdir -p /srv/www/htdocs && \ + ln -s /adei/src /srv/www/htdocs/adei && \ + for name in $(find /srv -mindepth 1 -maxdepth 1 -name '*.sh'); do rm "$name"; ln -s "/adei/src/scripts/cron/$(basename $name)" "$name"; done && \ + rm -f /etc/cron.d/adei.cron && \ + ln -s /adei/src/scripts/cron/adei.cron /etc/cron.d/adei.cron && \ + \ +# Consolidate all volumes in /adei + rm -rf /var/spool/mail && \ + ln -s /adei/log /var/spool/mail && \ + \ +# Modify for non-priviledged mode + chmod +rx /etc/php5/conf.d && \ + \ +# Ugly python needs to resolve user name + chmod g=u /etc/passwd + + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD /bin/bash diff --git a/adei-mini/Makefile b/adei-mini/Makefile new file mode 100644 index 0000000..ba30242 --- /dev/null +++ b/adei-mini/Makefile @@ -0,0 +1,20 @@ +all: build +install: push + +.PHONY: deps rebuild build push start stop restart bash + +deps: + docker pull chsa/microadei:latest + +build: deps Dockerfile + docker build --tag chsa/adei-minimal:latest . +# docker build --squash --tag chsa/adei-minimal-squashed:latest . + +rebuild: Dockerfile + docker build --no-cache --tag chsa/adei-minimal:latest . + +push: build + docker push chsa/adei-minimal:latest + +bash: build + docker exec -it adei-minimal /bin/bash diff --git a/adei-mini/files/docker-entrypoint.sh b/adei-mini/files/docker-entrypoint.sh new file mode 100755 index 0000000..6f0fa88 --- /dev/null +++ b/adei-mini/files/docker-entrypoint.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +set -e + +mkdir -p /adei/{src,cfg,tmp,sys,log} + +if ! whoami &> /dev/null; then + if [ -w /etc/passwd ]; then + echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd + fi +fi + +echo "Running: $@" +exec "$@" diff --git a/adei-mini/files/openshift-entrypoint.sh b/adei-mini/files/openshift-entrypoint.sh new file mode 100755 index 0000000..9353b5d --- /dev/null +++ b/adei-mini/files/openshift-entrypoint.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +mkdir -p /adei/{src,cfg,tmp,sys,log} + + +while [ ! -f /adei/cfg/.ready ]; do + echo "Waiting for ADEI intialization..." + sleep 5 +done + +while [ ! -f "$1" ]; do + echo "The script $1 is not populated yet. Waiting...." + sleep 1 +done + +echo "Running: $@" +exec /bin/bash "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 7dbbf8b..307ef42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -98,6 +98,18 @@ services: - ADEI_ENABLED_SETUPS=autogen ports: - 79:79 + + mini: + image: chsa/adei-minimal:latest + tty: true + entrypoint: /bin/bash + restart: always + volumes_from: + - data + links: + - mysql:adei-mysql + environment: + - ADEI_ENABLED_SETUPS=autogen volumes: db: diff --git a/kiwi/Makefile b/kiwi/Makefile new file mode 100644 index 0000000..f8f7497 --- /dev/null +++ b/kiwi/Makefile @@ -0,0 +1,19 @@ +all: build/microadei.x86_64-0.10.1.docker.tar.xz +install: push + +build/microadei.x86_64-0.10.1.docker.tar.xz: adei/config.xml adei/config.sh + rm -rf build/* + kiwi --type docker system build --description adei/ --target-dir ./build/ + du -sm build/build + +import: build/microadei.x86_64-0.10.1.docker.tar.xz + docker load < build/microadei.x86_64-0.10.1.docker.tar.xz + +push: import + docker push chsa/microadei:latest + +clean: + rm -rf build/* + +run: + docker run -it chsa/microadei:latest /bin/bash diff --git a/kiwi/adei/Dicefile b/kiwi/adei/Dicefile new file mode 100644 index 0000000..d335c88 --- /dev/null +++ b/kiwi/adei/Dicefile @@ -0,0 +1,3 @@ +Dice.configure do |config| + config.buildhost = :DOCKER +end diff --git a/kiwi/adei/config.sh b/kiwi/adei/config.sh new file mode 100644 index 0000000..57075fc --- /dev/null +++ b/kiwi/adei/config.sh @@ -0,0 +1,105 @@ +#!/bin/bash +#================ +# FILE : config.sh +#---------------- +# PROJECT : OpenSuSE KIWI Image System +# COPYRIGHT : (c) 2013 SUSE LLC +# : +# AUTHOR : Robert Schweikert <rjschwei@suse.com> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : configuration script for SUSE based +# : operating systems +# : +# : +# STATUS : BETA +#---------------- +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +#====================================== +# Greeting... +#-------------------------------------- +echo "Configure image: [$kiwi_iname]..." + +#====================================== +# Setup baseproduct link +#-------------------------------------- +suseSetupProduct + +#====================================== +# SuSEconfig +#-------------------------------------- +suseConfig + +#====================================== +# Import repositories' keys +#-------------------------------------- +suseImportBuildKey + +#====================================== +# Umount kernel filesystems +#-------------------------------------- +baseCleanMount + +#====================================== +# Add repositories +#-------------------------------------- +case $( arch ) in + x86_64 ) echo "Adding repos for x86_64" + zypper ar --refresh -K \ + http://download.opensuse.org/distribution/leap/42.3/repo/oss/suse/ "OSS" + zypper ar --refresh -K \ + http://download.opensuse.org/update/leap/42.3/oss/ "OSS Update" + zypper ar --refresh -K \ + http://download.opensuse.org/distribution/leap/42.3/repo/non-oss/suse/ "NON OSS" + zypper ar --refresh -K \ + http://download.opensuse.org/update/leap/42.3/non-oss/ "NON OSS Update" + ;; + aarch64 ) echo "Adding repo for aarch64" + zypper ar --refresh -K \ + http://download.opensuse.org/ports/aarch64/distribution/leap/42.3/repo/oss/ "OSS" + zypper ar --refresh -K \ + http://download.opensuse.org/ports/aarch64/distribution/leap/42.3/repo/oss/ "OSS Update" + ;; + ppc64le ) echo "Adding repo for ppc64le" + zypper ar --refresh -K \ + http://download.opensuse.org/ports/ppc/distribution/leap/42.3/repo/oss/ "OSS" + zypper ar --refresh -K \ + http://download.opensuse.org/ports/update/42.3/oss/ "OSS Update" + ;; + * ) echo "No repos for $arch" + ;; +esac + +#====================================== +# Disable recommends +#-------------------------------------- +sed -i 's/.*solver.onlyRequires.*/solver.onlyRequires = true/g' /etc/zypp/zypp.conf + +#====================================== +# Remove locale files +#-------------------------------------- +(cd /usr/share/locale && find -name '*.mo' | xargs rm) + +# Remove zypp uuid (bsc#1098535) +rm -f /var/lib/zypp/AnonymousUniqueId +# Systemd generates this in %post, remove it +rm -f /etc/machine-id + +# DS, this is called before 'delete' configured in 'config.xml'. So, we can't clean if removing from there +rpm -e --nodeps dbus-1 dracut fipscheck libfipscheck1 kbd kmod kmod-compat pinentry pkg-config exim \ + udev systemd systemd-sysvinit logrotate device-mapper libcryptsetup4 libdb-4_8 \ + cracklib cracklib-dict-full libcrack2 pam pam-config shadow util-linux aaa_base netcfg \ + ca-certificates openSUSE-build-key dirmngr perl-base insserv-compat \ + gpg2 openssl libncurses6 file file-magic libmagic1 libsolv-tools suse-module-tools \ + libzypp zypper rpm + +find . -name *.rpmsave -delete +rm -rf /var/lib/rpm + +exit 0 diff --git a/kiwi/adei/config.xml b/kiwi/adei/config.xml new file mode 100644 index 0000000..6122ab0 --- /dev/null +++ b/kiwi/adei/config.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> + +<image schemaversion="6.5" name="microadei"> + <description type="system"> + <author>Suren A. Chilingaryan</author> + <contact>csa@suren.me</contact> + <specification>Minimal ADEI container</specification> + </description> + <preferences> + <type image="docker"> + <containerconfig + name="chsa/microadei" + tag="latest" + maintainer="Suren A. Chilingaryan"/> + </type> + <version>0.10.1</version> + <packagemanager>zypper</packagemanager> + <rpm-check-signatures>false</rpm-check-signatures> + <rpm-force>true</rpm-force> + <rpm-excludedocs>true</rpm-excludedocs> + <locale>en_US</locale> + <keytable>us.map.gz</keytable> + <hwclock>utc</hwclock> + </preferences> + <users> + <user home="/root" name="root" groups="root"/> + </users> + <repository type="rpm-md" alias="kiwi" priority="1"> + <source path="obs://Virtualization:Appliances:Builder/openSUSE_Leap_42.3"/> + </repository> + <repository type="rpm-md" alias="Leap_42_3" imageinclude="true"> + <source path="obs://openSUSE:Leap:42.3/standard"/> + </repository> + <repository type="rpm-md" alias="ADEI" imageinclude="true"> + <source path="obs://home:/csa7fff:/adei/openSUSE_Leap_42.3/"/> + </repository> + + <packages type="bootstrap"> + <package name="udev"/> + <package name="filesystem"/> + <package name="ca-certificates"/> + <package name="openSUSE-release"/> + <package name="krb5-mini"/> + </packages> + <packages type="image"> + <package name="coreutils"/> + <package name="iputils"/> + <package name="openSUSE-build-key"/> + <package name="openSUSE-release"/> + <package name="openSUSE-release-ftp"/> + <package name="adei-req-cron"/> + <package name="adei-req-mssql"/> + </packages> +</image> diff --git a/kiwi/adei/config.xml.save b/kiwi/adei/config.xml.save new file mode 100644 index 0000000..a55ba45 --- /dev/null +++ b/kiwi/adei/config.xml.save @@ -0,0 +1,41 @@ + <packages type="delete"> + <package name="dbus-1"/> + <package name="dracut"/> + <package name="fipscheck"/> + <package name="glibc-locale"/> + <package name="kbd"/> + <package name="kmod"/> + <package name="pinentry"/> + <package name="pkg-config"/> + <package name="sg3_utils"/> + <package name="systemd"/> + <package name="systemd-sysvinit"/> + <package name="logrotate"/> + <package name="device-mapper"/> + <package name="libcryptsetup4"/> + <package name="exim"/> + <package name="udev"/> + <package name="cracklib"/> + <package name="cracklib-dict-full"/> + <package name="libcrack2"/> + <package name="pam"/> + <package name="pam-config"/> + <package name="shadow"/> + <package name="util-linux"/> + <package name="aaa_base"/> + <package name="netcfg"/> + <package name="ca-certificates"/> + <package name="ca-certificates-mozilla"/> + <package name="openSUSE-build-key"/> + <package name="dirmngr"/> + <package name="gpg2"/> + <package name="openssl"/> + <package name="libncurses6"/> + <package name="file"/> + <package name="file-magic"/> + <package name="libmagic1"/> + <package name="libsolv-tools"/> + <package name="suse-module-tools"/> + <package name="perl-base"/> + <package name="insserv-compat"/> + </packages> |