Skip to content

Commit

Permalink
Merge pull request mesosphere-backup#11 from mesosphere/ubuntu-dind
Browse files Browse the repository at this point in the history
Add Ubuntu Based DIND Agent
  • Loading branch information
sschneid authored Aug 25, 2016
2 parents 8472210 + c26a375 commit 8bb5531
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts/*
File renamed without changes.
35 changes: 35 additions & 0 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:16.04

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64

RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y \
apt-transport-https \
build-essential \
bzip2 \
ca-certificates \
ca-certificates-java \
curl \
git \
iptables \
jq \
lvm2 \
lxc \
openjdk-8-jre-headless \
unzip \
zip

ENV DIND_COMMIT 3b5fac462d21ca164b3778647420016315289034
# docker
RUN curl -sSL https://get.docker.com | sh
# fetch DIND script
RUN curl -sSL https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind -o /usr/local/bin/dind \
&& chmod a+x /usr/local/bin/dind

COPY ./wrapper.sh /usr/local/bin/wrapper.sh
RUN chmod a+x /usr/local/bin/wrapper.sh

VOLUME /var/lib/docker
ENTRYPOINT []
CMD []
78 changes: 78 additions & 0 deletions scripts/build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
TAG=${GIT_BRANCH#*/}

function usage() {
echo "$0 <image name> [yes] [tag prefix]"
echo "build Jenkins DIND Agent docker images."
echo ""
echo "<image name> is the image name, with prefix."
echo "[yes] is optional; include to also push images to docker hub."
echo "[tag prefix] is optional; include to overwrite using the git branch."
echo ""
exit -1
}

function preflight {
if [ ! -d ".git" ]
then
echo "This directory does not contain a .git directory."
echo "Please run this script from the jenkins-dind-agent root directory."
echo ""
exit -2
fi
}

function dock_build {
local image=$1
local tag=$2
local file=$3

echo "Building $image:$tag ..."
docker build -t $image:$tag -f $file .
}

function dock_push {
local image=$1
local tag=$2

echo "Pushing $image:$tag ..."
docker push $image:$tag
}

function build_images() {
if [ "x$1" == "x" ]
then
usage
else
image_name="$1"
fi

if [ "x$3" != "x" ]
then
TAG=$3
fi

preflight

for i in Dockerfile*
do
local possible_tag=${i#*.}
local tag_suffix=""
if [ "$possible_tag" != "Dockerfile" ]
then
tag_suffix="-${possible_tag}"
fi

final_tag="$TAG${tag_suffix}"

dock_build "$image_name" "$final_tag" "$i"

if [ "x$2" == "xyes" ]
then
dock_push "$image_name" "$final_tag"
fi
done
}

build_images $1 $2 $3

0 comments on commit 8bb5531

Please sign in to comment.