From 8bfb365dfde9d30e60af5adf96cdc8769499e43c Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Fri, 15 Jan 2021 00:31:07 -0500 Subject: [PATCH] Add deployment-time build tooling for custom docker images --- playbooks/deploy-compose.yml | 8 ++++++++ tasks/docker/build.yml | 23 +++++++++++++++++++++++ vars/applications.yml | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 tasks/docker/build.yml diff --git a/playbooks/deploy-compose.yml b/playbooks/deploy-compose.yml index 19f0bce..26ba0ff 100644 --- a/playbooks/deploy-compose.yml +++ b/playbooks/deploy-compose.yml @@ -23,6 +23,14 @@ - import_playbook: initialize.yml +- name: Build image + hosts: virtualization + vars_files: + - vars/applications.yml + tasks: + - import_tasks: tasks/docker/build.yml + + - name: Configure datastore hosts: jupiter vars_files: diff --git a/tasks/docker/build.yml b/tasks/docker/build.yml new file mode 100644 index 0000000..45cae89 --- /dev/null +++ b/tasks/docker/build.yml @@ -0,0 +1,23 @@ +--- +- name: Clone repositories + when: item.value.build is defined + git: + dest: /tmp/{{ item.key }} + repo: "{{ item.value.build.repository }}" + version: "{{ item.value.build.version }}" + loop: "{{ omni_compose_apps | dict2items }}" + loop_control: + label: "{{ item.key }}" + +- name: Build image + when: item.value.build is defined + docker_image: + source: build + name: "{{ item.key }}" + tag: "{{ item.value.build.version }}" + build: + path: /tmp/{{ item.key }} + rm: true + loop: "{{ omni_compose_apps | dict2items }}" + loop_control: + label: "{{ item.key }}" diff --git a/vars/applications.yml b/vars/applications.yml index 78ffbd0..ac506c0 100644 --- a/vars/applications.yml +++ b/vars/applications.yml @@ -85,6 +85,9 @@ omni_compose_apps: versions: default: "5.12" scipio: + build: + repository: git@github.com:tjyork/Scipio.git + version: 0.2.0 datastore: /appdata/scipio account: name: mech_scipio