Skip to content

Commit

Permalink
Merge pull request #2 from CodinGame/builder-runner
Browse files Browse the repository at this point in the history
Prepare for new builder-runner api
  • Loading branch information
Sy1v4in authored Mar 7, 2017
2 parents c559a02 + beca78f commit 89b05b5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:8-jdk
FROM codingame/java-compiler

MAINTAINER CodinGame <[email protected]>

Expand All @@ -16,6 +16,8 @@ ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

COPY settings.xml $USER_HOME_DIR/.m2/

COPY ./build.sh /project/build
COPY ./docker-entrypoint.sh /

ENTRYPOINT ["/docker-entrypoint.sh"]

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
This is the maven3 builder.
It aims at building the project, that is:
- create all the jar files
- copy the jar files into the target directory
- copy all the dependencies into the target directory
- copy the jars files and all the dependencies into the /project/target/jars directory
26 changes: 26 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

# Exit as soon as a command return status != 0
set -e

SRC_DIR=${1:-/project/target}
TARGET_DIR=${2:-/project/target/jars}

# Create target dir
mkdir -p ${TARGET_DIR}

cd ${SRC_DIR}

# Build the project: create all the jar files
mvn clean install jar:test-jar -DskipTests
# Copy the jar files into the target directory
find ${SRC_DIR} -name "*.jar" -not -path "${TARGET_DIR}/*" -exec cp {} ${TARGET_DIR} \;
# Copy all the dependencies into the target directory
mvn dependency:copy-dependencies -DoutputDirectory=${TARGET_DIR}

# Clean all except jars
shopt -s extglob
rm -rf !("jars")

# Clean .m2 directory
rm -rf ${HOME}/.m2
12 changes: 1 addition & 11 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
#!/usr/bin/env bash

SRC_DIR=${1:-/project/source}
TARGET_DIR=${2:-/project/target}

cd ${SRC_DIR}

# Build the project: create all the jar files
mvn clean install jar:test-jar -DskipTests
# Copy the jar files into the target directory
find . -name "*.jar" -exec cp {} ${TARGET_DIR} \;
# Copy all the dependencies into the target directory
mvn dependency:copy-dependencies -DoutputDirectory=${TARGET_DIR}
/project/build /project/source

0 comments on commit 89b05b5

Please sign in to comment.