Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

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