summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/instance/tasks/custom-image.yml
blob: f9e130a2a6afe7a0e157bd004d8cdadf5af9b9c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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