From 793ce37a07b2740d356608a71769317b56c409e6 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Wed, 2 Nov 2016 19:30:22 -0400 Subject: [PATCH] Get unit-test container working MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit node_modules was being overwritten by the bind-mount when the container started. This is kind of hacky, but it’s the only way to do this without changing everything. --- tools/docker-compose/unit-tests/Dockerfile | 14 ++++++++++++-- tools/docker-compose/unit-tests/entrypoint | 7 +++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tools/docker-compose/unit-tests/entrypoint diff --git a/tools/docker-compose/unit-tests/Dockerfile b/tools/docker-compose/unit-tests/Dockerfile index 756fe3f607..dfa7e56a39 100644 --- a/tools/docker-compose/unit-tests/Dockerfile +++ b/tools/docker-compose/unit-tests/Dockerfile @@ -41,7 +41,10 @@ RUN cd $(npm root -g)/npm \ RUN npm install -g npm@3.10.7 -WORKDIR "/ansible-tower" +# We need to install dependencies somewhere other than /ansible-tower. +# Anything in /ansible-tower will be overwritten by the bind-mount. +# We switch the WORKDIR to /ansible-tower further down. +WORKDIR "/tmp/ansible-tower" # Copy requirements files # NOTE: '*' is not used as it invalidates docker caching @@ -72,5 +75,12 @@ RUN npm set progress=false RUN make ui-deps -ENTRYPOINT ["/bin/bash", "-c"] +WORKDIR "/ansible-tower" + +# This entrypoint script takes care of moving the node_modules +# into the bind-mount, then exec's to whatever was passed as the CMD. +ADD tools/docker-compose/unit-tests/entrypoint /usr/bin/ +RUN chmod +x /usr/bin/entrypoint + +ENTRYPOINT ["entrypoint"] CMD ["bash"] diff --git a/tools/docker-compose/unit-tests/entrypoint b/tools/docker-compose/unit-tests/entrypoint new file mode 100644 index 0000000000..0fcf42881b --- /dev/null +++ b/tools/docker-compose/unit-tests/entrypoint @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +mkdir -p /ansible-tower/awx/ui/ +mv -n /tmp/ansible-tower/awx/ui/node_modules /ansible-tower/awx/ui + +exec $@