diff --git a/.travis.yml b/.travis.yml index e6e18e3..3532146 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ language: generic sudo: required env: - - DOCKER_VERSION=1.12.3 - - DOCKER_VERSION=1.11.2 - - DOCKER_VERSION=1.10.3 + - DOCKER_VERSION=1.13.1 DOCKER_PACKAGE_VERSION=$DOCKER_VERSION-0~ubuntu-precise + - DOCKER_VERSION=1.12.6 DOCKER_PACKAGE_VERSION=$DOCKER_VERSION-0~ubuntu-precise + - DOCKER_VERSION=1.11.2 DOCKER_PACKAGE_VERSION=$DOCKER_VERSION-0~precise before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock @@ -16,7 +16,7 @@ cache: before_install: - curl -sSL https://get.docker.com/ | sh - - sudo apt-get -y --force-yes install docker-engine=$DOCKER_VERSION-0~precise + - sudo apt-get -y --force-yes install docker-engine=$DOCKER_PACKAGE_VERSION # Build image with building environment - sudo docker build --tag=build-image . @@ -24,4 +24,4 @@ script: - sudo docker run -v $(pwd):/build -v $HOME/.m2:/root/.m2 -v $HOME/.gradle:/root/.gradle -v /var/run/docker.sock:/var/run/docker.sock build-image test --info after_success: - - test $TRAVIS_PULL_REQUEST == "false" && test "$TRAVIS_TAG" != "" && test $TRAVIS_REPO_SLUG == "avast/docker-compose-gradle-plugin" && test $DOCKER_VERSION == "1.12.3" && sudo docker run -v $(pwd):/build -v $HOME/.m2:/root/.m2 -v $HOME/.gradle:/root/.gradle -v /var/run/docker.sock:/var/run/docker.sock -e "BINTRAY_USER=$BINTRAY_USER" -e "BINTRAY_KEY=$BINTRAY_KEY" -e "GRADLE_PORTAL_KEY=$GRADLE_PORTAL_KEY" -e "GRADLE_PORTAL_SECRET=$GRADLE_PORTAL_SECRET" build-image bintrayUpload publishPlugins -Pversion="$TRAVIS_TAG" --info + - test $TRAVIS_PULL_REQUEST == "false" && test "$TRAVIS_TAG" != "" && test $TRAVIS_REPO_SLUG == "avast/docker-compose-gradle-plugin" && test $DOCKER_VERSION == "1.13.1" && sudo docker run -v $(pwd):/build -v $HOME/.m2:/root/.m2 -v $HOME/.gradle:/root/.gradle -v /var/run/docker.sock:/var/run/docker.sock -e "BINTRAY_USER=$BINTRAY_USER" -e "BINTRAY_KEY=$BINTRAY_KEY" -e "GRADLE_PORTAL_KEY=$GRADLE_PORTAL_KEY" -e "GRADLE_PORTAL_SECRET=$GRADLE_PORTAL_SECRET" build-image bintrayUpload publishPlugins -Pversion="$TRAVIS_TAG" --info diff --git a/Dockerfile b/Dockerfile index 15d22c2..b4f34de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,8 @@ # This is Dockerfile that defines build environment. -FROM java:8-jdk +FROM java:8u111-jdk-alpine MAINTAINER augustyn@avast.com -# install Docker -ENV DOCKER_VERSION=1.10.2 -RUN curl -sSL -O https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION} \ - && chmod +x docker-${DOCKER_VERSION} \ - && mv docker-${DOCKER_VERSION} /usr/local/bin/docker - -# install docker-compose -ENV COMPOSE_VERSION 1.6.2 -RUN curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-Linux-x86_64" \ - && chmod +x /usr/local/bin/docker-compose +RUN apk add --update libstdc++ docker=1.11.2-r1 py-pip=8.1.2-r0 && rm -rf /var/cache/apk/* && pip install --no-cache-dir docker-compose==1.11.2 # allow to bind local Docker to the outer Docker VOLUME /var/run/docker.sock diff --git a/README.md b/README.md index 51f7453..9e29149 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ dockerCompose { // removeImages = "None" // Other accepted values are: "All" and "Local" // removeVolumes = false // projectName = 'my-project' // allow to set custom docker-compose project name (defaults to directory name) - // executable = '/path/to/docker-compose' // allow to set the path of the docker-compose executable if not present in PATH + // executable = '/path/to/docker-compose' // allow to set the path of the docker-compose executable (usefull if not present in PATH) + // dockerExecutable = '/path/to/docker' // allow to set the path of the docker executable (usefull if not present in PATH) // environment.put 'BACKEND_ADDRESS', '192.168.1.100' // Pass environment variable to 'docker-compose' for substitution in compose file } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 51288f9..f9243df 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/main/groovy/com/avast/gradle/dockercompose/ComposeExtension.groovy b/src/main/groovy/com/avast/gradle/dockercompose/ComposeExtension.groovy index 6351f8c..ed88512 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/ComposeExtension.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/ComposeExtension.groovy @@ -36,6 +36,8 @@ class ComposeExtension { String executable = 'docker-compose' Map environment = new HashMap(System.getenv()); + String dockerExecutable = 'docker' + ComposeExtension(Project project, ComposeUp upTask, ComposeDown downTask) { this.project = project this.downTask = downTask @@ -89,6 +91,13 @@ class ComposeExtension { res } + @PackageScope + Iterable dockerCommand(String... args) { + def res = [dockerExecutable] + res.addAll(args) + res + } + VersionNumber getDockerComposeVersion() { def p = this.project def env = this.environment diff --git a/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy b/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy index 7b93b92..b684eac 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy @@ -64,6 +64,7 @@ class ComposeUp extends DefaultTask { @Override void run() { project.exec { ExecSpec e -> + e.environment = extension.environment e.commandLine extension.composeCommand('logs', '-f', '--no-color') e.standardOutput = new OutputStream() { def buffer = new ArrayList() @@ -163,7 +164,8 @@ class ComposeUp extends DefaultTask { Map getDockerInspection(String containerId) { new ByteArrayOutputStream().withStream { os -> project.exec { ExecSpec e -> - e.commandLine 'docker', 'inspect', containerId + e.environment = extension.environment + e.commandLine extension.dockerCommand('inspect', containerId) e.standardOutput os } def inspectionAsString = os.toString() @@ -302,7 +304,8 @@ class ComposeUp extends DefaultTask { def containerId = getContainerId(serviceName) new ByteArrayOutputStream().withStream { os -> project.exec { ExecSpec e -> - e.commandLine 'docker', 'logs', '--follow=false', containerId + e.environment = extension.environment + e.commandLine extension.dockerCommand('logs', '--follow=false', containerId) e.standardOutput = os } os.toString().trim()