commit 983e1291417199c19e85d4a01ceda7076e6e033c Author: Sameer Naik <sameer@damagehead.com> Date: Mon Apr 14 14:26:08 2014 +0530 initial creation diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c00df13 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.deb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2756b9f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:12.04 +MAINTAINER sameer@damagehead.com +ENV DEBIAN_FRONTEND noninteractive + +RUN sed 's/main$/main universe/' -i /etc/apt/sources.list +RUN apt-get update # 20140310 + +# essentials +RUN apt-get install -y vim curl wget sudo net-tools pwgen && \ + apt-get install -y logrotate supervisor openssh-server && \ + apt-get clean + +# build tools +# RUN apt-get install -y gcc make && apt-get clean + +# image specific +RUN apt-get install -y bind9 perl libnet-ssleay-perl openssl \ + libauthen-pam-perl libpam-runtime libio-pty-perl \ + apt-show-versions python && \ + apt-get clean + +ADD assets/ /app/ +RUN mv /app/.vimrc /app/.bash_aliases /root/ +RUN chmod 755 /app/init /app/setup/install && /app/setup/install + +ADD authorized_keys /root/.ssh/ +RUN chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys && chown root:root -R /root/.ssh + +EXPOSE 22 +ENTRYPOINT ["/app/init"] +CMD ["app:start"] diff --git a/assets/.bash_aliases b/assets/.bash_aliases new file mode 100644 index 0000000..d8e0acc --- /dev/null +++ b/assets/.bash_aliases @@ -0,0 +1,5 @@ +PS1='${debian_chroot:+($debian_chroot)}[\u@\h \W]# ' + +alias rm='rm -i' +alias cp='cp -i' + diff --git a/assets/.vimrc b/assets/.vimrc new file mode 100644 index 0000000..dc3331e --- /dev/null +++ b/assets/.vimrc @@ -0,0 +1,2 @@ +se ai +se sw=2 ts=2 diff --git a/assets/init b/assets/init new file mode 100755 index 0000000..7f8a2c9 --- /dev/null +++ b/assets/init @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +# generate a password for root. +ROOT_PASSWORD=$(pwgen -c -n -1 12) +echo "root:$ROOT_PASSWORD" | chpasswd +echo User: root Password: $ROOT_PASSWORD + +# start supervisord +/usr/bin/supervisord + +appStart () { + /etc/init.d/bind9 start + /etc/init.d/webmin start + tail -F /var/log/supervisor/supervisord.log +} + +appHelp () { + echo "Available options:" + echo " app:start - Start the app and watch the supervisor log (default)" + echo " app:help - Displays the help" + echo " [command] - Execute the specified linux command eg. bash." +} + +case "$1" in + app:start) + appStart + ;; + app:help) + appHelp + ;; + *) + if [ -x $1 ]; then + $1 + else + prog=$(which $1) + if [ -n "${prog}" ] ; then + shift 1 + $prog $@ + else + appHelp + fi + fi + ;; +esac + +exit 0 diff --git a/assets/setup/install b/assets/setup/install new file mode 100644 index 0000000..15b12fa --- /dev/null +++ b/assets/setup/install @@ -0,0 +1,24 @@ +#!/bin/bash + +WEBMIN_VERSION=1.680 + +# install webmin, use local copy .deb file if available +if [ -f /app/setup/webmin_${WEBMIN_VERSION}_all.deb ]; then + dpkg -i /app/setup/webmin_${WEBMIN_VERSION}_all.deb +else + wget "http://prdownloads.sourceforge.net/webadmin/webmin_${WEBMIN_VERSION}_all.deb" -P /tmp/ + dpkg -i /tmp/webmin_${WEBMIN_VERSION}_all.deb + rm -rf /tmp/webmin_${WEBMIN_VERSION}_all.deb +fi + +mkdir -p /var/run/sshd +cat > /etc/supervisor/conf.d/sshd.conf <<EOF +[program:sshd] +directory=/ +command=/usr/sbin/sshd -D +user=root +autostart=true +autorestart=true +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s_error.log +EOF diff --git a/authorized_keys b/authorized_keys new file mode 100644 index 0000000..e69de29