From deae4621ae11c2199ee228d6beac0f212fef2290 Mon Sep 17 00:00:00 2001 From: sprinteiro Date: Mon, 22 Jan 2018 19:02:51 +0000 Subject: [PATCH 1/4] ADD JAR_FILE variable to pass microservice JAR file name as parameter --- simpleservice/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simpleservice/Dockerfile b/simpleservice/Dockerfile index 2e33032..01be86f 100644 --- a/simpleservice/Dockerfile +++ b/simpleservice/Dockerfile @@ -2,7 +2,8 @@ FROM openjdk:8-jdk-alpine RUN apk update && apk upgrade && apk add netcat-openbsd RUN mkdir -p /usr/local/simple-service -ADD target/simple-service-0.0.1-SNAPSHOT.jar /usr/local/simple-service +ARG JAR_FILE +ADD target/${JAR_FILE} /usr/local/simple-service ADD src/main/docker/run.sh run.sh RUN chmod +x run.sh CMD ./run.sh From 4522ad29138e4d9775578c7c4d7ec66e6b6a3a98 Mon Sep 17 00:00:00 2001 From: sprinteiro Date: Mon, 22 Jan 2018 19:05:35 +0000 Subject: [PATCH 2/4] Add JAR_FILE with the parameterized JAR file name of microservice to dockerfile-maven-plugin configuration, and upgrage plugin version --- simpleservice/pom.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/simpleservice/pom.xml b/simpleservice/pom.xml index e99f5dd..c93a329 100644 --- a/simpleservice/pom.xml +++ b/simpleservice/pom.xml @@ -42,7 +42,7 @@ com.spotify dockerfile-maven-plugin - 1.3.4 + 1.3.7 default @@ -59,6 +59,9 @@ ${docker.image.name} ${docker.image.tag} + + ${project.build.finalName}.jar + From 6ed88dbcf56de79892d5b289114ecce8c2856564 Mon Sep 17 00:00:00 2001 From: sprinteiro Date: Mon, 22 Jan 2018 19:06:57 +0000 Subject: [PATCH 3/4] Remove docker build plug-in as dockerfile-maven (Docker build process) integrates with the Maven build process --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4f4d17..2d44e61 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ To build the code examples for Chapter 1 as a docker image, open a command-line Run the following maven command. This command will execute the [Spotify docker plugin](https://github.com/spotify/docker-maven-plugin) defined in the pom.xml file. - **mvn clean package docker:build** + **mvn clean package** If everything builds successfully you should see a message indicating that the build was successful. From d5e5e6e62a5603286ee5db7a77b384a19569a2e4 Mon Sep 17 00:00:00 2001 From: sprinteiro Date: Mon, 22 Jan 2018 22:58:33 +0000 Subject: [PATCH 4/4] Remove docker build plug-in from the Docker container build as dockerfile-maven integrate with the Maven build process --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b0013b..e99757e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,6 @@ env: - TMX_DOCKER_IMAGE=johncarnell/tmx-simple-service:chapter1 script: - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD -- mvn clean package docker:build +- mvn clean package - docker push $TMX_DOCKER_IMAGE - ecs-cli --version