Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
default only cache one time
Browse files Browse the repository at this point in the history
  • Loading branch information
qxo committed Sep 9, 2017
1 parent cc6192a commit 5e35826
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
language: bash

sudo: required
services:
- docker

script:
- docker build --rm --cache-from boot2docker/boot2docker -t boot2docker/boot2docker .
- docker run --rm boot2docker/boot2docker > ${TRAVIS_BUILD_DIR}/boot2docker.iso
- if [ -z "${DEPLOY_ISO_TO_GITHUB}" ] ; then export DEPLOY_ISO_TO_GITHUB=false ; fi

cache:
bundler: true
directories:
- $HOME/docker
before_cache:
- if [ ! "${NOT_CACHE_IMG_AFTER_BUILD}" = "true" ] ; then mkdir -p $HOME/docker && docker images --filter='dangling=false' --format '{{.Repository}}:{{.Tag}}' | grep -v none | xargs -n 1 -I {x} -t sh -c 'docker save {x} | gzip -2 > $HOME/docker/$(echo {x} | md5sum | awk "{print \$1}" ).tar.gz' ; echo ok ;fi
- imglist=$(find $HOME/docker/ -name "*.tar.gz");test -z "$imglist" && test ! "$FORCE_CACHE_IF_NOT" = "false" && NOT_CACHE_IMG_AFTER_BUILD=false ; test -n "$imglist" && test -z "$NOT_CACHE_IMG_AFTER_BUILD" && NOT_CACHE_IMG_AFTER_BUILD=true ; echo "$imglist"; if [ ! "${NOT_CACHE_IMG_AFTER_BUILD}" = "true" ] ; then mkdir -p $HOME/docker && docker images --filter='dangling=false' --format '{{.Repository}}:{{.Tag}}' | grep -v none | xargs -n 1 -I {x} -t sh -c 'docker save {x} | gzip -2 > $HOME/docker/$(echo {x} | md5sum | awk "{print \$1}" ).tar.gz' ; echo ok ;fi
- bash -c " ls -lA $HOME/docker/ "
before_install:
- if [ ! "${NOT_LOAD_CACHE_BEFORE_BUILD}" = "true" ] ; then if [[ -d $HOME/docker ]]; then imglist=$(find $HOME/docker/ -name "*.tar.gz"); echo "$imglist"; echo "${imglist}" | xargs -t -I {file} sh -c "zcat {file} | docker load"; fi ; bash -c "docker images -a --filter='dangling=false'" ; fi

services:
- docker
script:
- docker build --rm --cache-from boot2docker/boot2docker -t boot2docker/boot2docker .
- docker run --rm boot2docker/boot2docker > ${TRAVIS_BUILD_DIR}/boot2docker.iso
- if [ -z "${DEPLOY_ISO_TO_GITHUB}" ] ; then export DEPLOY_ISO_TO_GITHUB=false ; fi
after_script:
- docker images
- ls -l *.iso
Expand Down

0 comments on commit 5e35826

Please sign in to comment.