Skip to content

Commit

Permalink
Merge pull request #2065 from dnephin/use-dind-image
Browse files Browse the repository at this point in the history
Use dockerswarm/dind image for ci
  • Loading branch information
mnowster committed Sep 18, 2015
2 parents 41660f9 + 8b29a50 commit e2ab2eb
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 152 deletions.
34 changes: 11 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ RUN set -ex; \
zlib1g-dev \
libssl-dev \
git \
apt-transport-https \
ca-certificates \
curl \
lxc \
iptables \
libsqlite3-dev \
; \
rm -rf /var/lib/apt/lists/*

RUN curl https://get.docker.com/builds/Linux/x86_64/docker-latest \
-o /usr/local/bin/docker && \
chmod +x /usr/local/bin/docker

# Build Python 2.7.9 from source
RUN set -ex; \
curl -LO https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz; \
Expand Down Expand Up @@ -66,33 +67,20 @@ RUN set -ex; \
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8

ENV ALL_DOCKER_VERSIONS 1.7.1 1.8.2-rc1

RUN set -ex; \
curl https://get.docker.com/builds/Linux/x86_64/docker-1.7.1 -o /usr/local/bin/docker-1.7.1; \
chmod +x /usr/local/bin/docker-1.7.1; \
curl https://test.docker.com/builds/Linux/x86_64/docker-1.8.2-rc1 -o /usr/local/bin/docker-1.8.2-rc1; \
chmod +x /usr/local/bin/docker-1.8.2-rc1

# Set the default Docker to be run
RUN ln -s /usr/local/bin/docker-1.7.1 /usr/local/bin/docker

RUN useradd -d /home/user -m -s /bin/bash user
WORKDIR /code/

RUN pip install tox
RUN pip install tox==2.1.1

ADD requirements.txt /code/
RUN pip install -r requirements.txt

ADD requirements-dev.txt /code/
RUN pip install -r requirements-dev.txt

RUN pip install tox==2.1.1
ADD .pre-commit-config.yaml /code/
ADD setup.py /code/
ADD tox.ini /code/
ADD compose /code/compose/
RUN tox --notest

ADD . /code/
RUN pip install --no-deps -e /code

RUN chown -R user /code/

ENTRYPOINT ["/usr/local/bin/docker-compose"]
ENTRYPOINT ["/code/.tox/py27/bin/docker-compose"]
6 changes: 1 addition & 5 deletions script/build-linux
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ set -ex

TAG="docker-compose"
docker build -t "$TAG" .
docker run \
--rm \
--volume="$(pwd):/code" \
--entrypoint="script/build-linux-inner" \
"$TAG"
docker run --rm --entrypoint="script/build-linux-inner" "$TAG"
5 changes: 3 additions & 2 deletions script/build-linux-inner
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
set -ex

TARGET=dist/docker-compose-Linux-x86_64
VENV=/code/.tox/py27

mkdir -p `pwd`/dist
chmod 777 `pwd`/dist

pip install -r requirements-build.txt
su -c "pyinstaller docker-compose.spec" user
$VENV/bin/pip install -r requirements-build.txt
su -c "$VENV/bin/pyinstaller docker-compose.spec" user
mv dist/docker-compose $TARGET
$TARGET version
88 changes: 0 additions & 88 deletions script/dind

This file was deleted.

33 changes: 26 additions & 7 deletions script/test-versions
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,41 @@ docker run --rm \
--entrypoint="tox" \
"$TAG" -e pre-commit

ALL_DOCKER_VERSIONS="1.7.1 1.8.2"
DEFAULT_DOCKER_VERSION="1.8.2"

if [ "$DOCKER_VERSIONS" == "" ]; then
DOCKER_VERSIONS="default"
DOCKER_VERSIONS="$DEFAULT_DOCKER_VERSION"
elif [ "$DOCKER_VERSIONS" == "all" ]; then
DOCKER_VERSIONS="$ALL_DOCKER_VERSIONS"
fi


BUILD_NUMBER=${BUILD_NUMBER-$USER}

for version in $DOCKER_VERSIONS; do
>&2 echo "Running tests against Docker $version"

daemon_container="compose-dind-$version-$BUILD_NUMBER"
trap "docker rm -vf $daemon_container" EXIT

# TODO: remove when we stop testing against 1.7.x
daemon=$([[ "$version" == "1.7"* ]] && echo "-d" || echo "daemon")

docker run \
--rm \
-d \
--name "$daemon_container" \
--privileged \
--volume="/var/lib/docker" \
--volume="${COVERAGE_DIR:-$(pwd)/coverage-html}:/code/coverage-html" \
-e "DOCKER_VERSION=$version" \
-e "DOCKER_DAEMON_ARGS" \
--entrypoint="script/dind" \
dockerswarm/dind:$version \
docker $daemon -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \

docker run \
--rm \
--link="$daemon_container:docker" \
--env="DOCKER_HOST=tcp://docker:2375" \
--entrypoint="tox" \
"$TAG" \
script/wrapdocker tox -e py27,py34 -- "$@"
-e py27,py34 -- "$@"

done
27 changes: 0 additions & 27 deletions script/wrapdocker

This file was deleted.

1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ envlist = py27,py34,pre-commit
usedevelop=True
passenv =
LD_LIBRARY_PATH
DOCKER_HOST
setenv =
HOME=/tmp
deps =
Expand Down

0 comments on commit e2ab2eb

Please sign in to comment.