summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/tasks/custom-image.yml
blob: 3d9e31d1c521b43ee3397bc3539bb7bfa0060eff (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_base_path }}/{{ item.key }}/build"
    state: directory

- name: generate Dockerfile for custom image
  copy:
    content: |
      FROM {{ item.value.custom_image.from | default('nextcloud:' + item.value.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 item.value %}

      {{ item.value.custom_image.dockerfile }}
      {% endif %}
    dest: "{{ nextcloud_base_path }}/{{ item.key }}/build/Dockerfile"
  register: nextcloud_custom_image_docker

- name: build custom image
  docker_image:
    name: "nextcloud/{{ item.key }}:{{ item.value.version }}"
    state: present
    force_source: "{{ nextcloud_custom_image_docker is changed }}"
    source: build
    build:
      path: "{{ nextcloud_base_path }}/{{ item.key }}/build"
      network: host
      pull: yes