This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 20df1aa5ddf5b1f3606b83600ba68db2076dfa64
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Wed Apr 10 15:23:02 2019 +0700

    JAMES-2720 Using Dockerfile instead of mounts for LinShare
    
    Class path resources are not mounted well in some CI environements. Relying
    on on-the-fly Dockerfiles is a more portable approach, already used for 
LDAP testing.
---
 .../java/org/apache/james/linshare/Linshare.java   | 22 ++++++++++------------
 .../linshare/src/test/resources/backend/Dockerfile |  4 ++++
 .../{ => backend}/conf/catalina.properties         |  0
 .../resources/{ => backend}/conf/log4j.properties  |  0
 .../linshare/src/test/resources/smtp/Dockerfile    |  3 +++
 .../src/test/resources/{ => smtp}/conf/smtpd.conf  |  0
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git 
a/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java 
b/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
index 348ed17..f9a128f 100644
--- a/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
+++ b/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
@@ -21,10 +21,10 @@ package org.apache.james.linshare;
 
 import java.time.Duration;
 
-import org.testcontainers.containers.BindMode;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.Network;
 import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.images.builder.ImageFromDockerfile;
 
 public class Linshare {
     private static final String WAIT_FOR_BACKEND_INIT_LOG = ".*Server 
startup.*";
@@ -98,16 +98,20 @@ public class Linshare {
     }
 
     private GenericContainer createDockerSmtp() {
-        return new GenericContainer<>("linagora/opensmtpd")
+        return new GenericContainer<>(
+            new ImageFromDockerfile()
+                .withFileFromClasspath("conf/smtpd.conf", 
"smtp/conf/smtpd.conf")
+                .withFileFromClasspath("Dockerfile", "smtp/Dockerfile"))
             .withNetworkAliases("smtp", "linshare_smtp")
-            .withClasspathResourceMapping("./conf/smtpd.conf",
-                "/etc/smtpd/smtpd.conf",
-                BindMode.READ_ONLY)
             .withNetwork(network);
     }
 
     private GenericContainer createDockerBackend() {
-        return new GenericContainer<>("linagora/linshare-backend:2.2")
+        return new GenericContainer<>(
+            new ImageFromDockerfile()
+                .withFileFromClasspath("conf/log4j.properties", 
"backend/conf/log4j.properties")
+                .withFileFromClasspath("conf/catalina.properties", 
"backend/conf/catalina.properties")
+                .withFileFromClasspath("Dockerfile", "backend/Dockerfile"))
             .withNetworkAliases("backend")
             .withEnv("SMTP_HOST", "linshare_smtp")
             .withEnv("SMTP_PORT", "25")
@@ -118,12 +122,6 @@ public class Linshare {
             .withEnv("MONGODB_HOST", "linshare_mongodb")
             .withEnv("MONGODB_PORT", "27017")
             .withEnv("THUMBNAIL_ENABLE", "false")
-            .withClasspathResourceMapping("./conf/catalina.properties",
-                "/usr/local/tomcat/conf/catalina.properties",
-                BindMode.READ_ONLY)
-            .withClasspathResourceMapping("./conf/log4j.properties",
-                "/etc/linshare/log4j.properties",
-                BindMode.READ_ONLY)
             .withExposedPorts(LINSHARE_BACKEND_PORT)
             .waitingFor(Wait.forLogMessage(WAIT_FOR_BACKEND_INIT_LOG, 1)
                 .withStartupTimeout(Duration.ofMinutes(10)))
diff --git a/third-party/linshare/src/test/resources/backend/Dockerfile 
b/third-party/linshare/src/test/resources/backend/Dockerfile
new file mode 100644
index 0000000..f583d57
--- /dev/null
+++ b/third-party/linshare/src/test/resources/backend/Dockerfile
@@ -0,0 +1,4 @@
+FROM linagora/linshare-backend:2.2
+
+COPY conf/catalina.properties /usr/local/tomcat/conf/catalina.properties
+COPY conf/log4j.properties /etc/linshare/log4j.properties
diff --git a/third-party/linshare/src/test/resources/conf/catalina.properties 
b/third-party/linshare/src/test/resources/backend/conf/catalina.properties
similarity index 100%
rename from third-party/linshare/src/test/resources/conf/catalina.properties
rename to 
third-party/linshare/src/test/resources/backend/conf/catalina.properties
diff --git a/third-party/linshare/src/test/resources/conf/log4j.properties 
b/third-party/linshare/src/test/resources/backend/conf/log4j.properties
similarity index 100%
rename from third-party/linshare/src/test/resources/conf/log4j.properties
rename to third-party/linshare/src/test/resources/backend/conf/log4j.properties
diff --git a/third-party/linshare/src/test/resources/smtp/Dockerfile 
b/third-party/linshare/src/test/resources/smtp/Dockerfile
new file mode 100644
index 0000000..3b4b81a
--- /dev/null
+++ b/third-party/linshare/src/test/resources/smtp/Dockerfile
@@ -0,0 +1,3 @@
+FROM linagora/opensmtpd
+
+COPY conf/smtpd.conf /etc/smtpd/smtpd.conf
diff --git a/third-party/linshare/src/test/resources/conf/smtpd.conf 
b/third-party/linshare/src/test/resources/smtp/conf/smtpd.conf
similarity index 100%
rename from third-party/linshare/src/test/resources/conf/smtpd.conf
rename to third-party/linshare/src/test/resources/smtp/conf/smtpd.conf


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to