Skip to content

Commit

Permalink
docker script bash is working and the docker:build
Browse files Browse the repository at this point in the history
  • Loading branch information
dido18 committed May 19, 2016
1 parent 8d6b36c commit 823e1c6
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 106 deletions.
30 changes: 30 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,36 @@
<version>4.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>

<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.dido.pad.PadFsNode</mainClass>
</manifest>
</archive>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM java:alpine
VOLUME /tmp
ADD app.jar app.jar
ENTRYPOINT ["java","-cp","app.jar"]
ENTRYPOINT ["java","-jar","app.jar"]
26 changes: 26 additions & 0 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,33 @@
</execution>-->
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>

<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.dido.pad.cli.MainClient</mainClass>
</manifest>
</archive>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM java:alpine
VOLUME /tmp
ADD cli.jar cli.jar
ENTRYPOINT ["java","-cp","cli.jar"]
ENTRYPOINT ["java","-jar","cli.jar"]
28 changes: 28 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,34 @@
</executions>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>

<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.dido.pad.PadFsNode</mainClass>
</manifest>
</archive>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion core/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM java:alpine
VOLUME /tmp
ADD core.jar core.jar
ENTRYPOINT ["java","-cp","core.jar"]
ENTRYPOINT ["java","-jar","core.jar"]
2 changes: 1 addition & 1 deletion core/src/test/java/com/dido/pad/TestQuorum.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void setUP(){
}


@Test
//@Test
public void testGetMerge() {

try {
Expand Down
81 changes: 4 additions & 77 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,6 @@
<target>1.8</target>
</configuration>
</plugin>
<!-- Maven Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>

<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>${project.groupId}.PadFsNode</mainClass>
</manifest>
</archive>
</configuration>

<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down Expand Up @@ -113,69 +84,25 @@
</executions>
</plugin>

<!--Maven to docker plugin, https://fabric8io.github.io/docker-maven-plugin/installation.html -->
<!--<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.15.1</version>
<configuration>
<dockerHost>unix:///var/run/docker.sock</dockerHost>
<useColor>true</useColor>
<images>
&lt;!&ndash;A single's image configuration &ndash;&gt;
<image>
<name>padfs/${project.name}:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
<dockerFile>Dockerfile</dockerFile>
</build>
</image>
</images>
</configuration>
&lt;!&ndash;onnect start/stop to pre- and post-integration-test phase, respectively if you want to start
your docker containers during integration tests&ndash;&gt;
<executions>
&lt;!&ndash;execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
&lt;!&ndash; "build" should be used to create the images with the artifact &ndash;&gt;
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>&ndash;&gt;
</executions>
</plugin>-->

<!--copy al the jar into folder for Docker image-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<phase>package</phase>
<configuration>
<tasks>
<target>
<!--copy al the jar into /tmp folder for Docker -->
<copy todir="${project.basedir}/src/main/docker">
<fileset dir="${project.basedir}/target/">
<include name="**/*jar-with-dependencies.jar"/>
</fileset>
<!--change the name in cli.jar , core.jar -->
<globmapper from="*" to="${project.name}.jar"/>
</copy>

</tasks>
</target>
</configuration>
<goals>
<goal>run</goal>
Expand Down
25 changes: 0 additions & 25 deletions runDocker.pl

This file was deleted.

43 changes: 43 additions & 0 deletions runDocker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
## If ypu want to change the subnet_IP and the version_VER
# modify them olso in the perl script

IP_BASH='10.0.0'
VER_BASH='1.0'

perl -e 'use strict;
use warnings;
my $N = 4;
my $IP = "10.0.0";
my $VER = "1.0";
for my $i (1..$N){
`docker network disconnect pad-net node$i`;
}
`docker network disconnect pad-net cli`;
my $resRm = `docker network rm pad-net`;
print $resRm;
my $res = `docker network create --subnet=$IP.0/16 --gateway=$IP.254 pad-net`;
print "created Network : $res";
for my $i (1..$N){
$res = `docker stop node$i`;
print "Stopped: $res";
$res = `docker rm node$i`;
print "Removed container: $res";
$res = `docker run -d --name node$i --net pad-net --ip $IP.$i padfs/core:$VER -ip $IP.$i -id node$i $IP.2:node2`;
print "Created container : $res";
}
$res = `docker stop cli` ;
print "Stopped client: $res";
$res = `docker rm cli`;
print "Remove Client container: $res ";
'

docker run -it --name cli --net pad-net --ip $IP_BASH.253 padfs/cli:$VER_BASH -ip $IP_BASH.253 -id client $IP_BASH.2:node2

0 comments on commit 823e1c6

Please sign in to comment.