Shane McDonald c9b53cf975
Refactor image_build and image_push roles
Primary changes are:

- Generalized variable names (remove "docker")
- Add explicit "push" variable rather than checking if the "registry" variable is defined.
- Allow for passing in version as build arg
2021-10-12 18:59:13 -04:00

31 lines
950 B
YAML

---
- name: Verify awx-logos directory exists for official install
stat:
path: "../../../awx-logos"
register: logosdir
failed_when: logosdir.stat.isdir is not defined or not logosdir.stat.isdir
when: awx_official|default(false)|bool
- name: Copy logos for inclusion in sdist
copy:
src: "../../../awx-logos/awx/ui/client/assets/"
dest: "../../awx/ui/public/static/media/"
when: awx_official|default(false)|bool
- set_fact:
command_to_run: |
docker build -t {{ awx_image }}:{{ awx_image_tag }} \
-f {{ dockerfile_name }} \
--build-arg VERSION={{ awx_version }} \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION={{ awx_version }} \
--build-arg HEADLESS={{ headless }} \
.
# Calling Docker directly because docker-py doesnt support BuildKit
- name: Build AWX image
shell: "{{ command_to_run }}"
environment:
DOCKER_BUILDKIT: 1
args:
chdir: "{{ playbook_dir }}/../../"