Change Dockerfile to copy custom venv

This commit is contained in:
Stefan Jakobs 2020-07-22 14:00:05 +02:00
parent cf6c36ecab
commit 58da3df03e

View File

@ -83,15 +83,17 @@ index aa8b304..eb05f91 100644
+ virtualenv /opt/my-envs/my-custom-env
+ /opt/my-envs/my-custom-env/bin/pip install psutil
+
diff --git a/installer/image_build/templates/Dockerfile.j2 b/installer/image_build/templates/Dockerfile.j2
index d69e2c9..a08bae5 100644
--- a/installer/image_build/templates/Dockerfile.j2
+++ b/installer/image_build/templates/Dockerfile.j2
@@ -34,6 +34,7 @@ RUN yum -y install epel-release && \
pip install virtualenv supervisor && \
VENV_BASE=/var/lib/awx/venv make requirements_ansible && \
VENV_BASE=/var/lib/awx/venv make requirements_awx && \
+ VENV_BASE=/var/lib/awx/venv make requirements_custom && \
diff --git a/installer/roles/image_build/templates/Dockerfile.j2 b/installer/roles/image_build/templates/Dockerfile.j2
index d3b582ffcb..220ac760a3 100644
--- a/installer/roles/image_build/templates/Dockerfile.j2
+++ b/installer/roles/image_build/templates/Dockerfile.j2
@@ -165,6 +165,7 @@ RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/n
chmod 640 /etc/nginx/nginx.{csr,key,crt}
{% else %}
COPY --from=builder /var/lib/awx /var/lib/awx
+COPY --from=builder /opt/my-envs /opt/my-envs
RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage
{% endif %}
```
Once the AWX API is available, update the `CUSTOM_VENV_PATHS` setting as described in `Preparing a New Custom Virtualenv`.