awx/tools/docker-compose/start_tests.sh
Shane McDonald a361b5da6e
Fix permissions when running dev container as non-root user
I wanted to pass `—user` to `docker-compose` up, but that option doesnt exist. To get around this, I had to record the uid on the host (CURRENT_UID), interpolate the variable in tools/docker-compose.yml, and detect that inside the container. I then piggy-backed on the /etc/passwd hack we use for scenarios with unpredictable uids.
2018-10-24 10:30:04 -04:00

18 lines
523 B
Bash
Executable File

#!/bin/bash
set +x
if [ `id -u` -ge 500 ] || [ -z "${CURRENT_UID}" ]; then
echo "awx:x:`id -u`:`id -g`:,,,:/tmp:/bin/bash" >> /tmp/passwd
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
fi
cd /awx_devel
make clean
cp -R /tmp/awx.egg-info /awx_devel/ || true
sed -i "s/placeholder/$(cat /awx_devel/VERSION)/" /awx_devel/awx.egg-info/PKG-INFO
cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link
cp awx/settings/local_settings.py.docker_compose awx/settings/local_settings.py
make "${1:-test}"