This repository has been archived by the owner on Jun 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#453 Moved cli code into separate module
- Loading branch information
1 parent
1368964
commit cc83a10
Showing
32 changed files
with
165 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM containersol/alpine3.3-java8-jre:v1 | ||
MAINTAINER Container Solutions BV <[email protected]> | ||
|
||
ADD minimesos.jar /usr/local/share/minimesos/minimesos.jar | ||
ADD minimesos-cli.jar /usr/local/share/minimesos/minimesos-cli.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage | ||
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage | ||
import com.bmuschko.gradle.docker.tasks.image.DockerTagImage | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'application' | ||
apply plugin: 'com.bmuschko.docker-remote-api' | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { | ||
url "https://jitpack.io" | ||
} | ||
} | ||
|
||
group = "com.containersol.minimesos" | ||
|
||
dependencies { | ||
compile 'com.beust:jcommander:1.48' | ||
compile 'org.slf4j:slf4j-api:1.7.12' | ||
|
||
compile project(':minimesos') | ||
|
||
testCompile 'junit:junit:4.11' | ||
testCompile "org.mockito:mockito-core:1.+" | ||
// using guru.nidi as maintenanance of the original project is dropped https://github.com/clarkware/jdepend/pull/9 | ||
testCompile "guru.nidi:jdepend:2.9.5" | ||
} | ||
|
||
mainClassName = "com.containersol.minimesos.main.Main" | ||
|
||
ext { | ||
imageName = imagePrefix + '/minimesos-cli' | ||
} | ||
|
||
test { | ||
testLogging { | ||
showStandardStreams = true | ||
} | ||
} | ||
|
||
task executableJar(type: Jar) { | ||
baseName = "minimesos-cli" | ||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } | ||
with jar | ||
manifest { | ||
attributes( | ||
'Main-Class': mainClassName, | ||
'Implementation-Version': project.version | ||
) | ||
} | ||
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' | ||
} | ||
|
||
artifacts { | ||
archives executableJar | ||
} | ||
|
||
task copyFilesForDocker(type: Copy) { | ||
dependsOn 'executableJar' | ||
from "build/libs/minimesos-cli-${project.version}.jar" | ||
into 'build/docker' | ||
rename { String fileName -> | ||
fileName.replace("-${project.version}", "") | ||
} | ||
} | ||
|
||
task copyDockerfile(type: Copy) { | ||
dependsOn 'copyFilesForDocker' | ||
from "Dockerfile" | ||
into 'build/docker' | ||
} | ||
|
||
afterEvaluate { project -> | ||
if (new File(project.projectDir, 'Dockerfile').exists()) { | ||
if (!project.hasProperty('imageName')) { | ||
throw new GradleException('Root directory of ' + project.name | ||
+ ' contains Dockerfile, but it does not define project.ext.imageName value') | ||
} | ||
docker.url = 'unix:///var/run/docker.sock' | ||
if (!System.properties['os.name'].equals('Mac OS X')) { | ||
docker.certPath = null | ||
} | ||
if (System.env.DOCKER_HOST) { | ||
docker.url = "$System.env.DOCKER_HOST".replace("tcp", "https") | ||
if (System.env.DOCKER_CERT_PATH) { | ||
docker.certPath = new File(System.env.DOCKER_CERT_PATH) | ||
} | ||
} | ||
task buildDockerImage(type: DockerBuildImage, dependsOn: [copyDockerfile], description: 'build Docker image') { | ||
inputDir = new File("${buildDir}/docker") | ||
tag = project.imageName | ||
} | ||
project.build.dependsOn buildDockerImage | ||
['snapshot', 'version'].each { aTag -> | ||
String uppercasedName = aTag.capitalize() | ||
task "tagDockerImageWith$uppercasedName"(type: DockerTagImage, description: 'tag Docker image') { | ||
imageId = project.imageName | ||
tag = ('version'.equals(aTag)) ? project.version : aTag | ||
repository = project.imageName | ||
force = true | ||
} | ||
task "publishDockerImageWith$uppercasedName"(type: DockerPushImage, dependsOn: ["tagDockerImageWith$uppercasedName"], | ||
description: 'publish Docker image') { | ||
imageName = project.imageName | ||
tag = ('version'.equals(aTag)) ? project.version : aTag | ||
doFirst { | ||
['dockerHubUsername', 'dockerHubPassword', 'dockerHubEmail'].each { | ||
assert project.hasProperty(it): 'Undefined "' + it + '" property' | ||
} | ||
docker { | ||
registryCredentials { | ||
username = project.property('dockerHubUsername') | ||
password = project.property('dockerHubPassword') | ||
email = project.property('dockerHubEmail') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
assemble.dependsOn executableJar |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
minimesos { | ||
clusterName = "minimesos-test" | ||
mapPortsToHost = false | ||
loggingLevel = "INFO" | ||
mapAgentSandboxVolume = false | ||
mesosVersion = "0.25" | ||
timeout = 60 | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<configuration debug="false"> | ||
|
||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<target>System.out</target> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}: %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<logger name="com.containersol.minimesos" level="debug"/> | ||
|
||
<root level="warn"> | ||
<appender-ref ref="console" /> | ||
</root> | ||
|
||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters