1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 17:55:10 +03:00

More sane way of building the official AWX image

This commit is contained in:
Shane McDonald 2020-12-22 14:05:31 -05:00
parent 225c3d6a39
commit f951aa24bf
4 changed files with 22 additions and 86 deletions

1
.gitignore vendored
View File

@ -148,3 +148,4 @@ use_dev_supervisor.txt
*.#
/tools/docker-compose/overrides/
/awx/ui_next/.ui-built
/Dockerfile

View File

@ -13,9 +13,10 @@ RUN dnf -y update && dnf -y install epel-release && \
# Use the distro provided npm to bootstrap our required version of node
RUN npm install -g n && n 14.15.1 && dnf remove -y nodejs
RUN mkdir -p /.npm && chmod g+rwx /.npm
ENV PATH=/usr/local/n/versions/node/14.15.1/bin:$PATH
WORKDIR "/awx"
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["make sdist"]
CMD ["make", "sdist"]

View File

@ -34,7 +34,7 @@
register: sdist
- name: Clean distribution
shell: make clean
command: make clean
args:
chdir: ..
ignore_errors: true
@ -58,6 +58,10 @@
delegate_to: localhost
when: use_container_for_build|default(true)|bool
- name: Get current uid
command: id -u
register: uid
- name: Build AWX distribution using container
docker_container:
env:
@ -67,6 +71,7 @@
image: "awx_sdist_builder:{{ awx_version }}"
name: awx_sdist_builder
state: started
user: "{{ uid.stdout }}"
detach: false
volumes:
- ../:/awx:Z
@ -74,7 +79,7 @@
when: use_container_for_build|default(true)|bool
- name: Build AWX distribution locally
shell: make sdist
command: make sdist
args:
chdir: ..
delegate_to: localhost
@ -88,86 +93,15 @@
set_fact:
awx_image: "{{ awx_image|default('awx') }}"
- name: Ensure directory exists
file:
path: "{{ docker_base_path }}"
state: directory
delegate_to: localhost
- name: Stage sdist
copy:
src: "../dist/{{ awx_sdist_file }}"
dest: "{{ docker_base_path }}/{{ awx_sdist_file }}"
delegate_to: localhost
- name: Template web Dockerfile
- name: Render Dockerfile
template:
src: Dockerfile.j2
dest: "{{ docker_base_path }}/Dockerfile"
delegate_to: localhost
- name: Stage launch_awx
copy:
src: launch_awx.sh
dest: "{{ docker_base_path }}/launch_awx.sh"
mode: '0755'
delegate_to: localhost
- name: Stage launch_awx_task
copy:
src: launch_awx_task.sh
dest: "{{ docker_base_path }}/launch_awx_task.sh"
mode: '0755'
delegate_to: localhost
- name: Stage rsyslog.conf
copy:
src: rsyslog.conf
dest: "{{ docker_base_path }}/rsyslog.conf"
mode: '0660'
delegate_to: localhost
- name: Stage supervisor.conf
copy:
src: supervisor.conf
dest: "{{ docker_base_path }}/supervisor.conf"
delegate_to: localhost
- name: Stage supervisor_task.conf
copy:
src: supervisor_task.conf
dest: "{{ docker_base_path }}/supervisor_task.conf"
delegate_to: localhost
- name: Stage settings.py
copy:
src: settings.py
dest: "{{ docker_base_path }}/settings.py"
delegate_to: localhost
- name: Stage requirements
copy:
src: ../requirements/
dest: "{{ docker_base_path }}/requirements"
delegate_to: localhost
- name: Stage config watcher
copy:
src: ../tools/scripts/config-watcher
dest: "{{ docker_base_path }}/config-watcher"
mode: 0755
delegate_to: localhost
- name: Stage Makefile
copy:
src: ../Makefile
dest: "{{ docker_base_path }}/Makefile"
delegate_to: localhost
dest: ../Dockerfile
- name: Build base awx image
docker_image:
build:
path: "{{ docker_base_path }}"
path: ".."
dockerfile: Dockerfile
pull: false
args:

View File

@ -73,7 +73,7 @@ ADD requirements/requirements_dev.txt /tmp/requirements
RUN cd /tmp && make requirements_awx_dev requirements_ansible_dev
{% endif %}
{% if not build_dev|bool %}
COPY {{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
COPY dist/{{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
RUN mkdir -p -m 755 /var/lib/awx && \
OFFICIAL=yes /var/lib/awx/venv/awx/bin/pip install /tmp/{{ awx_sdist_file }}
{% endif %}
@ -177,7 +177,7 @@ RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage
{% endif %}
# Create default awx rsyslog config
ADD {% if build_dev|bool %}installer/roles/image_build/files/{% endif %}rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf
ADD installer/roles/image_build/files/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf
## File mappings
{% if build_dev|bool %}
@ -191,12 +191,12 @@ ADD tools/docker-compose/bootstrap_development.sh /usr/bin/bootstrap_development
ADD tools/docker-compose/entrypoint.sh /entrypoint.sh
ADD tools/scripts/awx-python /usr/bin/awx-python
{% else %}
ADD launch_awx.sh /usr/bin/launch_awx.sh
ADD launch_awx_task.sh /usr/bin/launch_awx_task.sh
ADD settings.py /etc/tower/settings.py
ADD supervisor.conf /etc/supervisord.conf
ADD supervisor_task.conf /etc/supervisord_task.conf
ADD config-watcher /usr/bin/config-watcher
ADD installer/roles/image_build/files/launch_awx.sh /usr/bin/launch_awx.sh
ADD installer/roles/image_build/files/launch_awx_task.sh /usr/bin/launch_awx_task.sh
ADD installer/roles/image_build/files/settings.py /etc/tower/settings.py
ADD installer/roles/image_build/files/supervisor.conf /etc/supervisord.conf
ADD installer/roles/image_build/files/supervisor_task.conf /etc/supervisord_task.conf
ADD tools/scripts/config-watcher /usr/bin/config-watcher
{% endif %}
# Pre-create things we need to access