blob: 5fd3f8156047f6fab1dce84e08feb20900943545 [file] [log] [blame]
---
# xos-docker-images/tasks/main.yml
- name: Build xos-base docker image
when: build_xos_base_image
docker_image:
name: "xosproject/xos-base"
path: "{{ cord_dir }}/orchestration/xos/containers/xos"
dockerfile: "Dockerfile.base"
- name: Pull xos-base docker image from Dockerhub
when: not build_xos_base_image
docker_image:
name: "xosproject/xos-base"
- name: Obtain XOS git repo metadata
command: "git log --pretty=format:'{\"XOS_GIT_COMMIT_DATE\":\"%ci\", \"XOS_GIT_COMMIT_HASH\":\"%H\"}' -n 1"
args:
chdir: "{{ cord_dir }}/orchestration/xos/"
register: xos_git_metadata
tags:
- skip_ansible_lint # idempotent git metadata retrieval, git module can't do this
# Should mount certs in the image rather than baking them in
- name: Copy over SSL CA certificates
copy:
src: "{{ pki_dir }}/im_cert_chain.pem"
dest: "{{ cord_dir }}/orchestration/xos/containers/xos/local_certs.crt"
mode: 0644
- name: Build xosproject/xos devel image
docker_image:
name: "xosproject/xos"
path: "{{ cord_dir }}/orchestration/xos/"
dockerfile: "containers/xos/Dockerfile.devel"
buildargs: "{{ xos_git_metadata.stdout }}"
pull: False # should use locally created, or already pulled xos-base image
- name: Build xosproject/xos-test testing image
when: build_xos_test_image
docker_image:
name: "xosproject/xos-test"
path: "{{ cord_dir }}/orchestration/xos/"
dockerfile: "containers/xos/Dockerfile.test"
pull: False # use the locally built copy of xosproject/xos
- name: Clean up chameleon temp directory
file:
path: "{{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon"
state: absent
- name: Populate chameleon temp directory
shell: cp -a "{{ cord_dir }}/component/chameleon" "{{ cord_dir }}/orchestration/xos/containers/chameleon/tmp.chameleon"
tags:
- skip_ansible_lint # docker can't access files outside of build context, so we must copy
- name: Build xosproject/chameleon image
docker_image:
name: "xosproject/chameleon"
path: "{{ cord_dir }}/orchestration/xos/containers/chameleon"
dockerfile: "Dockerfile.chameleon"
pull: False # use the locally built copy of xosproject/xos
- name: Build xosproject/xos-ws container image
docker_image:
name: "xosproject/xos-ws"
path: "{{ cord_dir }}/orchestration/xos-rest-gw" # TODO rename repo
dockerfile: "Dockerfile"
pull: False # use the locally built copy of xosproject/xos
- name: Build xosproject/xos-gui container image
docker_image:
name: "xosproject/xos-gui"
path: "{{ cord_dir }}/orchestration/xos-gui"
dockerfile: "Dockerfile"
pull: False # use the locally built copy of xosproject/xos
- name: Tag and push xos-base image to docker registry
when: push_xos_base_image
docker_image:
name: "{{ deploy_docker_registry }}/xosproject/xos-base"
tag: "{{ deploy_docker_tag }}"
push: yes
- name: Tag and push xos image to docker registry
when: push_xos_image
docker_image:
name: "{{ deploy_docker_registry }}/xosproject/xos"
tag: "{{ deploy_docker_tag }}"
push: True