From 068e3e3c3631521fdf92583aefe9738833c8e10d Mon Sep 17 00:00:00 2001 From: Joonas Bergius Date: Mon, 15 Aug 2016 21:59:01 -0400 Subject: [PATCH 1/2] Added scripts/docker-build.sh for building docker images in CI --- scripts/docker-build.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/docker-build.sh diff --git a/scripts/docker-build.sh b/scripts/docker-build.sh new file mode 100644 index 00000000000..f8691461b4a --- /dev/null +++ b/scripts/docker-build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" +if [ $? -ne 0 ]; then + echo "docker login failed." + exit 1 +fi + +docker build -t "$DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$DOCKER_TAG" . +if [ $? -ne 0 ]; then + echo "docker build failed." + exit 1 +fi + +docker push "$DOCKER_REPOSITORY/$DOCKER_IMAGE_NAME:$DOCKER_TAG" +if [ $? -ne 0 ]; then + echo "docker push failed." + exit 1 +fi + +exit 0 From 6f6fbe403af6049e47c5471535a90af56ac9b399 Mon Sep 17 00:00:00 2001 From: Joonas Bergius Date: Mon, 15 Aug 2016 22:00:34 -0400 Subject: [PATCH 2/2] Produce a docker image when there's a new tag --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 01fb25d8fce..e8822e5e330 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,11 @@ +sudo: required + +services: + - docker + +env: + - DOCKER_TAG=$TRAVIS_TAG + language: python python: - "2.7" @@ -6,3 +14,7 @@ install: - pip install pep8 script: - ./scripts/cibuild.sh +after_success: + - if [ ! -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + ./scripts/docker-build.sh; + fi