blob: 421fb6f02c3aef19e424ed8bba9358e258b18f05 [file] [log] [blame]
Zack Williamsa2763112017-01-03 11:38:38 -07001---
2# xos-docker-images/tasks/main.yml
3
4- name: Build xos-base docker image
5 when: build_xos_base_image
6 docker_image:
7 name: "xosproject/xos-base"
8 path: "{{ cord_dir }}/orchestration/xos/containers/xos"
9 dockerfile: "Dockerfile.base"
10
11- name: Pull xos-base docker image from Dockerhub
12 when: not build_xos_base_image
13 docker_image:
14 name: "xosproject/xos-base"
15
16- name: Obtain XOS git repo metadata
17 command: "git log --pretty=format:'{\"XOS_GIT_COMMIT_DATE\":\"%ci\", \"XOS_GIT_COMMIT_HASH\":\"%H\"}' -n 1"
18 args:
19 chdir: "{{ cord_dir }}/orchestration/xos/"
20 register: xos_git_metadata
21 tags:
22 - skip_ansible_lint # idempotent git metadata retrieval, git module can't do this
23
Andy Bavier1cac0012017-03-13 10:06:18 -040024# Should mount certs in the image rather than baking them in
Zack Williamsa2763112017-01-03 11:38:38 -070025- name: Copy over SSL CA certificates
26 copy:
Andy Bavier1cac0012017-03-13 10:06:18 -040027 src: "{{ pki_dir }}/im_cert_chain.pem"
Zack Williamsa2763112017-01-03 11:38:38 -070028 dest: "{{ cord_dir }}/orchestration/xos/containers/xos/local_certs.crt"
29 mode: 0644
30
31- name: Build xosproject/xos devel image
32 docker_image:
33 name: "xosproject/xos"
34 path: "{{ cord_dir }}/orchestration/xos/"
35 dockerfile: "containers/xos/Dockerfile.devel"
36 buildargs: "{{ xos_git_metadata.stdout }}"
37 pull: False # should use locally created, or already pulled xos-base image
38
39- name: Build xosproject/xos-test testing image
40 when: build_xos_test_image
41 docker_image:
42 name: "xosproject/xos-test"
43 path: "{{ cord_dir }}/orchestration/xos/"
44 dockerfile: "containers/xos/Dockerfile.test"
45 pull: False # use the locally built copy of xosproject/xos
46
Scott Baker5ca4bd12017-02-10 15:17:06 -080047- name: Clean up chameleon temp directory
Andy Bavier1cac0012017-03-13 10:06:18 -040048 file:
49 path: "{{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon"
50 state: absent
Scott Baker5ca4bd12017-02-10 15:17:06 -080051
52- name: Populate chameleon temp directory
53 shell: cp -a "{{ cord_dir }}/component/chameleon" "{{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon"
54 tags:
55 - skip_ansible_lint # docker can't access files outside of build context, so we must copy
56
57- name: Build xosproject/chameleon image
58 docker_image:
59 name: "xosproject/chameleon"
60 path: "{{ cord_dir }}/orchestration/xos/containers/chameleon"
61 dockerfile: "Dockerfile.chameleon"
62 pull: False # use the locally built copy of xosproject/xos
63
Scott Baker970f24b2017-02-13 14:16:40 -080064- name: Build xosproject/xos-rest-gw container image
65 docker_image:
66 name: "xosproject/xos-rest-gw"
67 path: "{{ cord_dir }}/orchestration/xos-rest-gw"
68 dockerfile: "Dockerfile"
69 pull: False # use the locally built copy of xosproject/xos
70
71- name: Build xosproject/xos-gui container image
72 docker_image:
73 name: "xosproject/xos-gui"
74 path: "{{ cord_dir }}/orchestration/xos-gui"
75 dockerfile: "Dockerfile"
76 pull: False # use the locally built copy of xosproject/xos
77
Zack Williamsa2763112017-01-03 11:38:38 -070078- name: Tag and push xos-base image to docker registry
79 when: push_xos_base_image
80 docker_image:
81 name: "{{ deploy_docker_registry }}/xosproject/xos-base"
82 tag: "{{ deploy_docker_tag }}"
83 push: yes
84
85- name: Tag and push xos image to docker registry
86 when: push_xos_image
87 docker_image:
88 name: "{{ deploy_docker_registry }}/xosproject/xos"
89 tag: "{{ deploy_docker_tag }}"
90 push: True