Allow for building headless mode

This will only be used in CI and maybe other places where we dont need a UI
This commit is contained in:
Shane McDonald 2021-10-12 18:57:29 -04:00
parent 727b4668c2
commit f1520e1a70
No known key found for this signature in database
GPG Key ID: 6F374AF6E9EB9374
5 changed files with 29 additions and 9 deletions

View File

@ -379,7 +379,7 @@ clean-ui:
awx/ui/node_modules:
NODE_OPTIONS=--max-old-space-size=4096 $(NPM_BIN) --prefix awx/ui --loglevel warn ci
$(UI_BUILD_FLAG_FILE):
$(UI_BUILD_FLAG_FILE): awx/ui/node_modules
$(PYTHON) tools/scripts/compilemessages.py
$(NPM_BIN) --prefix awx/ui --loglevel warn run compile-strings
$(NPM_BIN) --prefix awx/ui --loglevel warn run build
@ -391,7 +391,9 @@ $(UI_BUILD_FLAG_FILE):
cp -r awx/ui/build/static/media/* awx/public/static/media
touch $@
ui-release: awx/ui/node_modules $(UI_BUILD_FLAG_FILE)
ui-release: $(UI_BUILD_FLAG_FILE)
ui-devel: awx/ui/node_modules
@$(MAKE) -B $(UI_BUILD_FLAG_FILE)
@ -420,10 +422,17 @@ dev_build:
release_build:
$(PYTHON) setup.py release_build
dist/$(SDIST_TAR_FILE): ui-release VERSION
HEADLESS ?= no
ifeq ($(HEADLESS), yes)
dist/$(SDIST_TAR_FILE):
else
dist/$(SDIST_TAR_FILE): $(UI_BUILD_FLAG_FILE)
endif
$(PYTHON) setup.py $(SDIST_COMMAND)
ln -sf $(SDIST_TAR_FILE) dist/awx.tar.gz
sdist: dist/$(SDIST_TAR_FILE)
echo $(HEADLESS)
@echo "#############################################"
@echo "Artifacts:"
@echo dist/$(SDIST_TAR_FILE)

View File

@ -1,6 +1,7 @@
---
build_dev: false
kube_dev: false
headless: no
dockerfile_dest: '../..'
dockerfile_name: 'Dockerfile'
template_dest: '_build'

View File

@ -17,6 +17,4 @@ set -e
wait-for-migrations
awx-manage collectstatic --noinput --clear
supervisord -c /etc/supervisord.conf

View File

@ -11,6 +11,7 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
USER root
# Install build dependencies
@ -27,7 +28,9 @@ RUN dnf -y update && \
libffi-devel \
libtool-ltdl-devel \
make \
{% if not headless|bool %}
nodejs \
{% endif %}
nss \
openldap-devel \
patch \
@ -44,6 +47,7 @@ RUN dnf -y update && \
RUN python3.8 -m ensurepip && pip3 install "virtualenv < 20"
# Install & build requirements
ADD Makefile /tmp/Makefile
RUN mkdir /tmp/requirements
@ -56,19 +60,27 @@ RUN cd /tmp && make requirements_awx
ARG VERSION
ARG SETUPTOOLS_SCM_PRETEND_VERSION
ARG HEADLESS
{% if (build_dev|bool) or (kube_dev|bool) %}
ADD requirements/requirements_dev.txt /tmp/requirements
RUN cd /tmp && make requirements_awx_dev
{% else %}
# 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
{% if not headless|bool %}
RUN npm install -g n && n 14.15.1
{% endif %}
# Copy source into builder, build sdist, install it into awx venv
COPY . /tmp/src/
WORKDIR /tmp/src/
RUN make sdist && \
/var/lib/awx/venv/awx/bin/pip install dist/awx-$(cat VERSION).tar.gz
RUN make sdist && /var/lib/awx/venv/awx/bin/pip install dist/awx.tar.gz
{% if not headless|bool %}
RUN /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear
{% endif %}
{% endif %}
# Final container(s)

View File

@ -2,4 +2,4 @@
awx_image: ansible/awx
awx_image_tag: "{{ awx_version }}"
dockerfile_name: 'Dockerfile'
headless: no