summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/instance/tasks/custom-image.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/apps/nextcloud/instance/tasks/custom-image.yml')
-rw-r--r--roles/apps/nextcloud/instance/tasks/custom-image.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/apps/nextcloud/instance/tasks/custom-image.yml b/roles/apps/nextcloud/instance/tasks/custom-image.yml
new file mode 100644
index 00000000..f9e130a2
--- /dev/null
+++ b/roles/apps/nextcloud/instance/tasks/custom-image.yml
@@ -0,0 +1,31 @@
+---
+- name: create build directory for custom image
+ file:
+ path: "{{ nextcloud_instance_basepath }}/build"
+ state: directory
+
+- name: generate Dockerfile for custom image
+ copy:
+ content: |
+ FROM {{ nextcloud_instances[nextcloud_instance].custom_image.from | default('nextcloud:' + nextcloud_instances[nextcloud_instance].version) }}
+
+ RUN set -x \
+ && addgroup --gid {{ nextcloud_app_gid }} nc-app \
+ && adduser --uid {{ nextcloud_app_uid }} --gid {{ nextcloud_app_gid }} --system --no-create-home --home /var/www/html --disabled-login --disabled-password nc-app
+ {% if 'custom_image' in nextcloud_instances[nextcloud_instance] %}
+
+ {{ nextcloud_instances[nextcloud_instance].custom_image.dockerfile }}
+ {% endif %}
+ dest: "{{ nextcloud_instance_basepath }}/build/Dockerfile"
+ register: nextcloud_custom_image_docker
+
+- name: build custom image
+ docker_image:
+ name: "nextcloud/{{ nextcloud_instance }}:{{ nextcloud_instances[nextcloud_instance].version }}"
+ state: present
+ force_source: "{{ nextcloud_custom_image_docker is changed }}"
+ source: build
+ build:
+ path: "{{ nextcloud_instance_basepath }}/build"
+ network: host
+ pull: yes