packer.json 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {
  2. "variables": {
  3. "base_container" : "{{ env `BASE_CONTAINER` }}",
  4. "docker_registry" : "{{ env `DOCKER_REGISTRY` }}",
  5. "container_name" : "{{ env `CONTAINER_NAME` }}",
  6. "build_number" : "{{ env `BUILD_NUMBER` }}"
  7. },
  8. "builders": [
  9. {
  10. "type" : "docker",
  11. "image" : "{{user `base_container`}}",
  12. "commit" : true,
  13. "changes" : [
  14. "WORKDIR /example",
  15. "EXPOSE 8080",
  16. "ENTRYPOINT /usr/bin/java -jar -Dexample.docker /example/target/example.one-jar.jar"
  17. ]
  18. }
  19. ],
  20. "provisioners": [
  21. {
  22. "type" : "shell",
  23. "inline" : [
  24. "apt-get -y update",
  25. "apt-get install -y python-pip python-dev libssl-dev libffi-dev",
  26. "pip install ansible"
  27. ]
  28. },
  29. {
  30. "type" : "ansible-local",
  31. "playbook_file" : "./ansible/docker-base.yml"
  32. },
  33. {
  34. "type" : "file",
  35. "source" : "./",
  36. "destination" : "/example"
  37. },
  38. {
  39. "type" : "shell",
  40. "inline" : [
  41. "cd /example",
  42. "mvn dependency:sources",
  43. "mvn dependency:resolve -Dclassifier=javadoc",
  44. "mvn compile",
  45. "mvn package"
  46. ]
  47. }
  48. ],
  49. "post-processors": [
  50. [
  51. {
  52. "type" : "docker-tag",
  53. "repository" : "{{user `docker_registry`}}/{{user `container_name` }}",
  54. "tag" : "{{user `build_number`}}"
  55. }
  56. ]
  57. ]
  58. }