summaryrefslogtreecommitdiff
path: root/roles/elevate/media/tasks/nextcloud-custom-image.yml
blob: 46f06dbff157bfee586c0d979c60d1c63702e184 (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: "{{ elevate_media_nextcloud_base_path }}/{{ elevate_media_nextcloud_instance_name }}/build"
    state: directory

- name: generate Dockerfile for custom image
  copy:
    content: |
      FROM {{ elevate_media_nextcloud_instance.custom_image.from | default('nextcloud:' + elevate_media_nextcloud_instance.version) }}

      RUN set -x \
          && addgroup --gid {{ elevate_media_share_gid }} nc-app \
          && adduser --uid {{ elevate_media_share_uid }} --gid {{ elevate_media_share_gid }} --system --no-create-home --home /var/www/html --disabled-login --disabled-password  nc-app
      {% if 'custom_image' in elevate_media_nextcloud_instance %}

      {{ elevate_media_nextcloud_instance.custom_image.dockerfile }}
      {% endif %}
    dest: "{{ elevate_media_nextcloud_base_path }}/{{ elevate_media_nextcloud_instance_name }}/build/Dockerfile"
  register: nextcloud_custom_image_docker

- name: build custom image
  docker_image:
    name: "nextcloud/{{ elevate_media_nextcloud_instance_name }}:{{ elevate_media_nextcloud_instance.version }}"
    state: present
    force_source: "{{ nextcloud_custom_image_docker is changed }}"
    source: build
    build:
      path: "{{ elevate_media_nextcloud_base_path }}/{{ elevate_media_nextcloud_instance_name }}/build"
      network: host
      pull: yes