initial creation

pull/2/head
Sameer Naik 2014-04-14 14:26:08 +05:30
commit 983e129141
7 changed files with 111 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.deb

31
Dockerfile Normal file
View File

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

5
assets/.bash_aliases Normal file
View File

@ -0,0 +1,5 @@
PS1='${debian_chroot:+($debian_chroot)}[\u@\h \W]# '
alias rm='rm -i'
alias cp='cp -i'

2
assets/.vimrc Normal file
View File

@ -0,0 +1,2 @@
se ai
se sw=2 ts=2

48
assets/init Executable file
View File

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

24
assets/setup/install Normal file
View File

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

0
authorized_keys Normal file
View File