From 71943300827294599ed8a4339b03a54bc354795d Mon Sep 17 00:00:00 2001
From: Ludovic Claude <ludovic.claude54@gmail.com>
Date: Wed, 24 Aug 2016 17:34:33 +0200
Subject: [PATCH] Streamline build, use user 1000 when building

---
 captain.yml                 | 7 ++++---
 pom.xml                     | 4 ----
 src/docker/build/Dockerfile | 4 ++++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/captain.yml b/captain.yml
index bc39d0905..a6d435576 100644
--- a/captain.yml
+++ b/captain.yml
@@ -4,7 +4,7 @@ portal-backend-build:
   pre:
     - echo "Building portal-backend-build"
   post:
-    - docker run --rm -v $WORKSPACE:/opt/portal/ -v $WORKSPACE/.m2:/root/.m2/ hbpmip/portal-backend-build
+    - docker run --rm -v $WORKSPACE:/opt/portal/ -v $HOME/.m2:/home/build/.m2/ hbpmip/portal-backend-build
     - echo "Finished building portal-backend-build"
   test:
     - ./tests/test-build.sh
@@ -14,8 +14,9 @@ portal-backend:
   image: hbpmip/portal-backend
   pre:
     - echo "Building portal-backend"
-    - cp -r $WORKSPACE/config/ $WORKSPACE/src/docker/run/config/
-    - cp -r $WORKSPACE/target/ $WORKSPACE/src/docker/run/target/
+    - mkdir -p $WORKSPACE/src/docker/run/config $WORKSPACE/src/docker/run/target
+    - cp $WORKSPACE/config/application.tmpl $WORKSPACE/src/docker/run/config/
+    - cp $WORKSPACE/target/*.jar $WORKSPACE/src/docker/run/target/
   post:
     - rm -rf $WORKSPACE/src/docker/run/target/
     - rm -rf $WORKSPACE/src/docker/run/config/
diff --git a/pom.xml b/pom.xml
index 907f8d5b7..a71dda721 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,10 +61,6 @@
             <artifactId>spring-data-commons</artifactId>
             <version>${spring-data-commons.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-security</artifactId>
diff --git a/src/docker/build/Dockerfile b/src/docker/build/Dockerfile
index 2f62e5c9a..51495aebc 100644
--- a/src/docker/build/Dockerfile
+++ b/src/docker/build/Dockerfile
@@ -2,6 +2,10 @@ FROM maven:3-jdk-8
 
 MAINTAINER mirco.nasuti@chuv.ch
 
+# Create a user with id 1000, with some luck it should match your user on the host machine.
+RUN adduser --quiet --uid 1000 build
+USER build
+
 COPY ./build-in-docker.sh /build-in-docker.sh
 
 VOLUME /opt/portal/
-- 
GitLab