{"action":"created","issue":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/2988","repository_url":"https://api.github.com/repos/jhipster/generator-jhipster","labels_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/2988/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/2988/comments","events_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/2988/events","html_url":"https://github.com/jhipster/generator-jhipster/issues/2988","id":136402816,"number":2988,"title":"[Feature] Microservice workflow with docker","user":{"login":"PierreBesson","id":513471,"avatar_url":"https://avatars.githubusercontent.com/u/513471?v=3","gravatar_id":"","url":"https://api.github.com/users/PierreBesson","html_url":"https://github.com/PierreBesson","followers_url":"https://api.github.com/users/PierreBesson/followers","following_url":"https://api.github.com/users/PierreBesson/following{/other_user}","gists_url":"https://api.github.com/users/PierreBesson/gists{/gist_id}","starred_url":"https://api.github.com/users/PierreBesson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierreBesson/subscriptions","organizations_url":"https://api.github.com/users/PierreBesson/orgs","repos_url":"https://api.github.com/users/PierreBesson/repos","events_url":"https://api.github.com/users/PierreBesson/events{/privacy}","received_events_url":"https://api.github.com/users/PierreBesson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jhipster/generator-jhipster/labels/feature%20request","name":"feature request","color":"0052cc"},{"url":"https://api.github.com/repos/jhipster/generator-jhipster/labels/JH%203.0","name":"JH 3.0","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-02-25T14:29:46Z","updated_at":"2016-02-29T07:31:24Z","closed_at":null,"body":"For microservices, we would like to be able to have a workflow that uses docker to run the registry, the gateway, microservices, databases, monitoring tools.\r\nThis could take the form of one or several docker-compose file.\r\n\r\nWhat needs to be done:\r\n- Every app should have a Dockerfile that is used to create a docker image of this app.\r\n- The app must be composed with it's dependencies: for example a database\r\n- All apps are composed with the registry and  additional tools (ELK, Graphite/Grafana).\r\n\r\nWhat is already decided:\r\n- Our images will be based on Alpine as having small images is important.\r\n\r\nInterrogation:\r\n- How to build the docker image ? Should we build the jar with Maven/Gradle (using a docker plugin) and then copy it to a container ? Should we use a separate container to build the apps from sources ? The latter way would allow to (re)build the image from docker only if the sources have been updated.\r\n\r\nI started experimenting for some time and have managed to start everything at once using the following  setup:\r\n\r\n**docker-compose.yml**\r\n```\r\njhipster-registry:\r\n  container_name: jhipster-registry\r\n  build: ./jhipster-registry/\r\n  environment:\r\n    - \"SPRING_PROFILES=dev,native\"\r\n  ports:\r\n    - \"8761:8761\"\r\n  volumes:\r\n    - ./central-config:/central-config\r\ngateway:\r\n  container_name: gateway\r\n  build: ./gateway/\r\n  ports:\r\n    - \"8080:8080\"\r\n  links:\r\n    - jhipster-registry:registry\r\napp1:\r\n  container_name: app1\r\n  build: ./app1/\r\n  ports:\r\n    - \"8081:8081\"\r\n  links:\r\n    - jhipster-registry:registry\r\napp2:\r\n  container_name: app2\r\n  build: ./app2/\r\n  ports:\r\n    - \"8082:8081\"\r\n  links:\r\n    - jhipster-registry:registry\r\n```\r\n\r\n**Microservice and gateway Dockerfile**\r\n```\r\nFROM anapsix/alpine-java\r\nADD target/*.war app.war\r\nRUN bash -c 'touch /app.war'\r\nEXPOSE 8080\r\nVOLUME /tmp\r\nCMD java -jar -Deureka.client.serviceUrl.defaultZone=http://registry:8761/eureka/ -Dspring.cloud.config.uri=http://registry:8761/config app.war\r\n```\r\n\r\nIf you are already familiar with docker and are interested in this, please give your feedback and contribute ideas so that we can release a first POC. It would be nice to have this ready for the JH3 release in two weeks."},"comment":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/comments/190075206","html_url":"https://github.com/jhipster/generator-jhipster/issues/2988#issuecomment-190075206","issue_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/2988","id":190075206,"user":{"login":"deepu105","id":1107223,"avatar_url":"https://avatars.githubusercontent.com/u/1107223?v=3","gravatar_id":"","url":"https://api.github.com/users/deepu105","html_url":"https://github.com/deepu105","followers_url":"https://api.github.com/users/deepu105/followers","following_url":"https://api.github.com/users/deepu105/following{/other_user}","gists_url":"https://api.github.com/users/deepu105/gists{/gist_id}","starred_url":"https://api.github.com/users/deepu105/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepu105/subscriptions","organizations_url":"https://api.github.com/users/deepu105/orgs","repos_url":"https://api.github.com/users/deepu105/repos","events_url":"https://api.github.com/users/deepu105/events{/privacy}","received_events_url":"https://api.github.com/users/deepu105/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T07:31:23Z","updated_at":"2016-02-29T07:31:23Z","body":"Oh Ok, I have to get myself familiar with docker soon :)\n\nThanks & Regards,\nDeepu\n\nOn Mon, Feb 29, 2016 at 3:22 PM, Pascal Grimaud <notifications@github.com>\nwrote:\n\n> It's a docker image : debian jessie + lib + jre8 + war\n> it's like a mini VM\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/jhipster/generator-jhipster/issues/2988#issuecomment-190073664>\n> .\n>\n"}}