build-arm64-playbook.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. # Setup joystream code, build docker image
  3. - name: Build image and push to docker hub
  4. hosts: all
  5. tasks:
  6. - block:
  7. - name: Get code from git repo
  8. include_role:
  9. name: common
  10. tasks_from: get-code-git
  11. - name: Install Docker Module for Python
  12. pip:
  13. name: docker
  14. - name: Log into DockerHub
  15. community.docker.docker_login:
  16. username: '{{ docker_username }}'
  17. password: '{{ docker_password }}'
  18. - name: Build an image and push it to a private repo
  19. community.docker.docker_image:
  20. build:
  21. path: ./joystream
  22. dockerfile: '{{ dockerfile }}'
  23. platform: '{{ platform }}'
  24. name: '{{ repository }}'
  25. tag: '{{ tag_name }}'
  26. push: yes
  27. source: build
  28. # Run in async fashion for max duration of 2 hours
  29. async: 7200
  30. poll: 0
  31. register: build_result
  32. - name: Check on build async task
  33. async_status:
  34. jid: '{{ build_result.ansible_job_id }}'
  35. register: job_result
  36. until: job_result.finished
  37. # Max number of times to check for status
  38. retries: 72
  39. # Check for the status every 100s
  40. delay: 100
  41. always:
  42. - name: Delete the stack
  43. amazon.aws.cloudformation:
  44. stack_name: '{{ stack_name }}'
  45. state: 'absent'
  46. delegate_to: localhost