Matrix Docker Ansible eploy
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
3.3 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. FROM {{ matrix_synapse_docker_image }}
  3. {% if matrix_synapse_container_image_customizations_auto_accept_invite_installation_enabled %}
  4. RUN pip install synapse-auto-accept-invite=={{ matrix_synapse_ext_synapse_auto_accept_invite_version }}
  5. {% endif %}
  6. {% if matrix_synapse_container_image_customizations_s3_storage_provider_installation_enabled %}
  7. RUN pip install synapse-s3-storage-provider=={{ matrix_synapse_ext_synapse_s3_storage_provider_version }}
  8. {% endif %}
  9. {% if matrix_synapse_container_image_customizations_templates_enabled %}
  10. {#
  11. This ugly script below does quite a lot:
  12. - installs git and other dependencies temporarily, just so we could do a shallow-clone
  13. - prepare the SSH config: keyscanning (if enabled), private key (if enabled)
  14. - performs a git shallow clone with just the branch we need
  15. - makes sure the files are owned by the user that will actually run the container later
  16. - removes the `.git` directory to save space, but keeps git revision in `git-revision.txt`, should we need it for debugging
  17. - finally, verifies that the templates path can indeed be found within the base path (sanity check)
  18. #}
  19. {% set dependencies = ['git', 'ssh', 'openssh-client'] %}
  20. RUN \
  21. {% if matrix_synapse_container_image_customizations_templates_git_repository_ssh_private_key %}
  22. echo '{{ matrix_synapse_container_image_customizations_templates_git_repository_ssh_private_key | b64encode }}' | base64 -d > /custom-templates-private-key && \
  23. chmod 400 /custom-templates-private-key && \
  24. {% endif %}
  25. apt-get update && \
  26. apt-get install --no-install-recommends -y {{ dependencies | join(' ') }} && \
  27. {% if matrix_synapse_container_image_customizations_templates_git_repository_keyscan_enabled %}
  28. mkdir ~/.ssh && \
  29. chmod 700 ~/.ssh && \
  30. ssh-keyscan -t rsa {{ matrix_synapse_container_image_customizations_templates_git_repository_keyscan_hostname }} >> ~/.ssh/known_hosts && \
  31. {% endif %}
  32. {% if matrix_synapse_container_image_customizations_templates_git_repository_ssh_private_key %}GIT_SSH_COMMAND='ssh -i /custom-templates-private-key'{% endif %} git \
  33. clone \
  34. --branch={{ matrix_synapse_container_image_customizations_templates_git_repository_branch }} \
  35. --depth=1 \
  36. --single-branch \
  37. --no-tags \
  38. {{ matrix_synapse_container_image_customizations_templates_git_repository_url }} \
  39. {{ matrix_synapse_container_image_customizations_templates_in_container_base_path }} && \
  40. /bin/sh -c 'cd {{ matrix_synapse_container_image_customizations_templates_in_container_base_path }} && git rev-parse HEAD > git-revision.txt' && \
  41. rm -rf {{ matrix_synapse_container_image_customizations_templates_in_container_base_path }}/.git && \
  42. chown -R {{ matrix_synapse_uid }}:{{ matrix_synapse_gid }} {{ matrix_synapse_container_image_customizations_templates_in_container_base_path }} && \
  43. apt-get autoremove -y {{ dependencies | join(' ') }} && \
  44. {% if matrix_synapse_container_image_customizations_templates_git_repository_ssh_private_key %}
  45. rm /custom-templates-private-key && \
  46. {% endif %}
  47. true
  48. RUN /bin/sh -c 'stat {{ matrix_synapse_container_image_customizations_templates_in_container_base_path }}/{{ matrix_synapse_container_image_customizations_templates_in_container_template_files_relative_path }} || exit 1'
  49. {% endif %}
  50. {{ matrix_synapse_container_image_customizations_dockerfile_body_custom }}