1
0
Fork 0

Add support for installing arbitrary packages in the customized container image

Related to https://github.com/mother-of-all-self-hosting/ansible-role-nextcloud/pull/12
This commit is contained in:
Slavi Pantaleev 2023-12-03 12:33:04 +02:00
parent c3d5f18024
commit 3c18ed01f2
3 changed files with 26 additions and 13 deletions

View file

@ -87,6 +87,8 @@ nextcloud_container_image_customizations_enabled: |
nextcloud_container_image_customizations_php_imageick_installation_enabled
or
nextcloud_container_image_customizations_samba_enabled
or
nextcloud_container_image_customizations_packages_to_install | length > 0
)
}}
@ -97,12 +99,24 @@ nextcloud_container_image_customizations_enabled: |
# https://github.com/nextcloud/server/issues/13099
# Tread wisely!
nextcloud_container_image_customizations_php_imageick_installation_enabled: false
nextcloud_container_image_customizations_php_imageick_installation_package: "libmagickcore-6.q16-6-extra"
nextcloud_container_image_customizations_php_imageick_installation_packages: ['libmagickcore-6.q16-6-extra']
# Samba (SMB) support for Windows fileshares can be setup using the toggle below, which
# installs the smbclient package per the example here https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/smb/apache/Dockerfile
# Also see ../../templates/customizations/Dockerfile.j2
nextcloud_container_image_customizations_samba_enabled: false
nextcloud_container_image_customizations_samba_packages: ['procps', 'smbclient']
# A list of packages to install in the customized Nextcloud container image.
# To add your own, use `nextcloud_container_image_customizations_packages_to_install_custom`
nextcloud_container_image_customizations_packages_to_install: "{{ (nextcloud_container_image_customizations_packages_to_install_auto + nextcloud_container_image_customizations_packages_to_install_custom) | unique }}"
nextcloud_container_image_customizations_packages_to_install_auto: |
{{
(nextcloud_container_image_customizations_php_imageick_installation_packages if nextcloud_container_image_customizations_php_imageick_installation_enabled else [])
+
(nextcloud_container_image_customizations_samba_packages if nextcloud_container_image_customizations_samba_enabled else [])
}}
nextcloud_container_image_customizations_packages_to_install_custom: []
# nextcloud_container_image_customizations_dockerfile_body_custom contains your custom Dockerfile steps
# for building your customized Nextcloud image based on the original (upstream) image (`nextcloud_container_image`).

View file

@ -14,6 +14,15 @@
- nextcloud_database_username
- nextcloud_database_password
- name: (Deprecation) Catch and report renamed Nextcloud variables
ansible.builtin.fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
when: "vars | dict2items | selectattr('key', 'match', item.old) | list | items2dict"
with_items:
- {'old': 'nextcloud_container_image_customizations_php_imageick_installation_package', 'new': '<superseded by nextcloud_container_image_customizations_php_imageick_installation_packages>'}
- when: nextcloud_container_labels_traefik_enabled | bool
block:
- name: Fail if required Nextcloud Traefik settings not defined

View file

@ -1,17 +1,7 @@
FROM {{ nextcloud_container_image }}
{% set packages_to_install = [] %}
{% if nextcloud_container_image_customizations_php_imageick_installation_enabled %}
{% set packages_to_install = packages_to_install + [nextcloud_container_image_customizations_php_imageick_installation_package] %}
{% endif %}
{% if nextcloud_container_image_customizations_samba_enabled %}
{% set packages_to_install = packages_to_install + ['procps', 'smbclient'] %}
{% endif %}
{% if packages_to_install | length > 0 %}
RUN apt -y update && apt -y install {{ packages_to_install | join(' ') }} && rm -rf /var/lib/apt/lists/*
{% if nextcloud_container_image_customizations_packages_to_install | length > 0 %}
RUN apt -y update && apt -y install {{ nextcloud_container_image_customizations_packages_to_install | join(' ') }} && rm -rf /var/lib/apt/lists/*
{% endif %}
{{ nextcloud_container_image_customizations_dockerfile_body_custom }}