Move container build files into their own dir and introduce the scope script.

This commit is contained in:
Tom Wilkie
2015-05-18 20:23:12 +00:00
parent 0040b25f69
commit 84d724f645
6 changed files with 167 additions and 11 deletions

11
docker/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM gliderlabs/alpine
MAINTAINER Weaveworks Inc <help@weave.works>
WORKDIR /home/weave
RUN apk add --update supervisor
RUN ["sh", "-c", "rm -rf /var/cache/apk/*"]
ADD supervisord.conf /etc/
ADD ./app /home/weave/
ADD ./probe /home/weave/
ADD ./entrypoint.sh /home/weave/
EXPOSE 4040
ENTRYPOINT ["/home/weave/entrypoint.sh"]

44
docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
usage() {
echo "$0 --dns <IP> --hostname <NAME> --searchpath <SEARCHPATH>"
exit 1
}
# This script exists to modify the network settings in the scope containers
# as docker doesn't allow it when started with --net=host
while true; do
case "$1" in
--dns)
[ $# -gt 1 ] || usage
DNS_SERVER="$2"
shift 2
;;
--hostname)
[ $# -gt 1 ] || usage
HOSTNAME="$2"
shift 2
;;
--searchpath)
[ $# -gt 1 ] || usage
SEARCHPATH="$2"
shift 2
;;
*)
break
;;
esac
done
if [ -n "$DNS_SERVER" -a -n "$SEARCHPATH" ]; then
echo "domain $SEARCHPATH" >/etc/resolv.conf
echo "search $SEARCHPATH" >>/etc/resolv.conf
echo "nameserver $DNS_SERVER" >>/etc/resolv.conf
fi
if [ -n "$HOSTNAME" ]; then
echo "$HOSTNAME" >/etc/hostname
hostname -F /etc/hostname
fi
/usr/bin/supervisord -c /etc/supervisord.conf

16
docker/supervisord.conf Normal file
View File

@@ -0,0 +1,16 @@
[supervisord]
nodaemon=true
[program:app]
command=/home/weave/app
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:probe]
command=/home/weave/probe -proc.root=/hostproc
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0