Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from mesosphere/add-docker-image
Browse files Browse the repository at this point in the history
Add docker image
  • Loading branch information
lloesche committed Feb 19, 2015
2 parents 9f0ef59 + c41daed commit c68179e
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
OUTPUT := $(shell pwd)/packages
DOCKER_OUT := $(shell pwd)/docker
VERSION ?= 0.1

.PHONY: help
Expand Down Expand Up @@ -50,9 +51,19 @@ debian-wheezy-77: packages
docker build -t mesosphere/mesosdnsbuilder-debian-wheezy debian-wheezy
docker run -v $(OUTPUT):/target mesosphere/mesosdnsbuilder-debian-wheezy bap $(VERSION)

.PHONY: docker-rootfs
docker-rootfs:
docker build -t mesosphere/mesosdnsbuilder-docker-rootfs docker-rootfs
docker run -v $(DOCKER_OUT):/target mesosphere/mesosdnsbuilder-docker-rootfs bap $(VERSION)

.PHONY: docker
docker: docker-rootfs
docker build -t mesosphere/mesos-dns docker

.PHONY: clean
clean:
rm -rf '$(OUTPUT)'
rm -f docker/mesos-dns_rootfs.tar.gz

packages:
mkdir -p '$(OUTPUT)'
26 changes: 26 additions & 0 deletions docker-rootfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM centos:centos7
MAINTAINER Mesosphere Package Builder <[email protected]>

RUN yum -y update && \
yum -y install epel-release && \
yum -y group install 'Development Tools' && \
yum -y install golang && \
yum clean all

RUN mkdir -p /build/ && \
mkdir -p /package/root/ && \
mkdir -p /package/root/etc/ && \
mkdir -p /package/root/usr/bin/

RUN cd /package/root/etc/ && ln -s /proc/mounts mtab

COPY etc/group /package/root/etc/
COPY etc/hostname /package/root/etc/
COPY etc/hosts /package/root/etc/
COPY etc/nsswitch.conf /package/root/etc/
COPY etc/passwd /package/root/etc/
COPY etc/resolv.conf /package/root/etc/

COPY bap.sh /usr/bin/bap

CMD ["bap"]
27 changes: 27 additions & 0 deletions docker-rootfs/bap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
if [ ! -d /target ]
then
echo "output directory /target not found"
exit 1
fi
mkdir -p /build/
mkdir -p /package/root/
mkdir -p /package/root/usr/bin/
mkdir -p /package/root/lib64/
export GOPATH=/build
go get github.com/miekg/dns
go get github.com/mesosphere/mesos-dns
cd $GOPATH/src/github.com/mesosphere/mesos-dns
go build -o mesos-dns
strip mesos-dns
cp mesos-dns /package/root/usr/bin/
cp /lib64/ld-linux-x86-64.so.2 /package/root/lib64/
cp /lib64/libc.so.6 /package/root/lib64/
cp /lib64/libnss_compat.so.2 /package/root/lib64/
cp /lib64/libnss_dns.so.2 /package/root/lib64/
cp /lib64/libnss_files.so.2 /package/root/lib64/
cp /lib64/libpthread.so.0 /package/root/lib64/
cd /package/root
tar czvf ../mesos-dns_rootfs.tar.gz .
cd ..
cp mesos-dns_rootfs.tar.gz /target/
11 changes: 11 additions & 0 deletions docker-rootfs/etc/group
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root:x:0:
bin:x:1:
daemon:x:2:
adm:x:4:
lp:x:7:
mail:x:12:
games:x:20:
ftp:x:50:
nobody:x:99:
users:x:100:
nfsnobody:x:65534:
Empty file added docker-rootfs/etc/hostname
Empty file.
Empty file added docker-rootfs/etc/hosts
Empty file.
4 changes: 4 additions & 0 deletions docker-rootfs/etc/nsswitch.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
passwd: files
shadow: files
group: files
hosts: files dns
13 changes: 13 additions & 0 deletions docker-rootfs/etc/passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
Empty file added docker-rootfs/etc/resolv.conf
Empty file.
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
MAINTAINER Mesosphere Package Builder <[email protected]>
ADD mesos-dns_rootfs.tar.gz /

CMD ["/usr/bin/mesos-dns"]

0 comments on commit c68179e

Please sign in to comment.