{"action":"created","issue":{"url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/236","repository_url":"https://api.github.com/repos/spotify/docker-maven-plugin","labels_url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/236/comments","events_url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/236/events","html_url":"https://github.com/spotify/docker-maven-plugin/issues/236","id":159650292,"number":236,"title":"Ability to specify target filename","user":{"login":"jmkgreen","id":105936,"avatar_url":"https://avatars3.githubusercontent.com/u/105936?v=3","gravatar_id":"","url":"https://api.github.com/users/jmkgreen","html_url":"https://github.com/jmkgreen","followers_url":"https://api.github.com/users/jmkgreen/followers","following_url":"https://api.github.com/users/jmkgreen/following{/other_user}","gists_url":"https://api.github.com/users/jmkgreen/gists{/gist_id}","starred_url":"https://api.github.com/users/jmkgreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmkgreen/subscriptions","organizations_url":"https://api.github.com/users/jmkgreen/orgs","repos_url":"https://api.github.com/users/jmkgreen/repos","events_url":"https://api.github.com/users/jmkgreen/events{/privacy}","received_events_url":"https://api.github.com/users/jmkgreen/received_events","type":"User","site_admin":false},"labels":[{"id":109107199,"url":"https://api.github.com/repos/spotify/docker-maven-plugin/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-10T14:40:21Z","updated_at":"2017-03-09T01:27:44Z","closed_at":"2016-09-19T13:48:38Z","body":"## Description\n\nFeature: Ability to specify target filename for the `jar` command to execute.\n\nRight now it is only possible copy the project's filename into a folder. This means downstream docker-compose files can run the containers but cannot override the `entryPoint` without knowing the names of the artefacts involved.\n\nExample: `entryPoint` ends up as `java -jar /my-final-name-version-SNAPSHOT.jar`\n\nRight now I have about a dozen containers in a compose file. And I want to override the -Jmx settings. AFAICT I need to supply the full entrypoint for each container and that means not only knowing the Maven level project file name but also the Maven project version. That's a lot of knowledge spreading downstream that could change.\n\nI tried specifying a `targetPath` that was in fact a filename but it still gets treated as a folder within the container.\n"},"comment":{"url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/comments/285225684","html_url":"https://github.com/spotify/docker-maven-plugin/issues/236#issuecomment-285225684","issue_url":"https://api.github.com/repos/spotify/docker-maven-plugin/issues/236","id":285225684,"user":{"login":"lcamilo15","id":601572,"avatar_url":"https://avatars2.githubusercontent.com/u/601572?v=3","gravatar_id":"","url":"https://api.github.com/users/lcamilo15","html_url":"https://github.com/lcamilo15","followers_url":"https://api.github.com/users/lcamilo15/followers","following_url":"https://api.github.com/users/lcamilo15/following{/other_user}","gists_url":"https://api.github.com/users/lcamilo15/gists{/gist_id}","starred_url":"https://api.github.com/users/lcamilo15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcamilo15/subscriptions","organizations_url":"https://api.github.com/users/lcamilo15/orgs","repos_url":"https://api.github.com/users/lcamilo15/repos","events_url":"https://api.github.com/users/lcamilo15/events{/privacy}","received_events_url":"https://api.github.com/users/lcamilo15/received_events","type":"User","site_admin":false},"created_at":"2017-03-09T01:27:44Z","updated_at":"2017-03-09T01:27:44Z","body":"I was able to accomplish this. The idea is to have a  ${basedir}/Dockerfile that maven uses as resource filtering and includes it within ${basedir}/src/main/docker/. \r\n\r\n[Resource Filtering](https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html#)\r\n[Copying Resource](https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html#)\r\n\r\nPlease make sure that ${basedir}/src/main/docker/ exists\r\n\r\non your pom.xml\r\n\r\n```xml\r\n<plugin>\r\n\t<artifactId>maven-resources-plugin</artifactId>\r\n\t<version>3.0.2</version>\r\n\t<executions>\r\n\t\t<execution>\r\n\t\t\t<id>copy-resources</id>\r\n\t\t\t<phase>validate</phase>\r\n\t\t\t<goals>\r\n\t\t\t\t<goal>copy-resources</goal>\r\n\t\t\t</goals>\r\n\t\t\t<configuration>\r\n\t\t\t\t<outputDirectory>${basedir}/src/main/docker/</outputDirectory>\r\n\t\t\t\t<resources>\r\n\t\t\t\t\t<resource>\r\n\t\t\t\t\t\t<directory>${basedir}</directory>\r\n\t\t\t\t\t\t<includes>\r\n\t\t\t\t\t\t\t<include>Dockerfile</include>\r\n\t\t\t\t\t\t</includes>\r\n\t\t\t\t\t\t<filtering>true</filtering>\r\n\t\t\t\t\t</resource>\r\n\t\t\t\t</resources>\r\n\t\t\t</configuration>\r\n\t\t</execution>\r\n\t</executions>\r\n</plugin>\r\n```\r\n\r\nIn ${basedir}/Dockerfile, Please note we are using @VAR-NAME@ instead of ${VAR-NAME}\r\n```docker\r\nFROM java:8\r\nVOLUME /tmp\r\nADD @project.build.finalName@.jar app.jar\r\nRUN bash -c 'touch /app.jar'\r\nEXPOSE 8888\r\nENTRYPOINT [\"java\",\"-Djava.security.egd=file:/dev/./urandom\",\"-jar\",\"/app.jar\"]\r\n```\r\n\r\n"}}
{"actor":{"display_login":"lcamilo15"}}