I’m running tests in a custom Docker image with Circle’s Docker executor.
My Docker image has this entrypoint in its Dockerfile.
ENTRYPOINT ["/usr/local/bin/activate.sh"]
All this entrypoint script does is start Postgres and source a Python virtualenv.
I want the test execution to respect this entrypoint. Circle docs say
For primary container (listed first in the list) if no
command
is specified thencommand
and image entrypoint will be ignored
These two .circleci/config.yml
don’t work.
build:
docker:
- image: freelawproject/courtlistener-testing:0.1.0
entrypoint: /usr/local/bin/activate.sh
steps:
- checkout
- run: rm -fr /var/www/courtlistener
- run: mv ~/project /var/www/courtlistener
- run: cp /var/www/courtlistener/cl/settings/05-private.example /var/www/courtlistener/cl/settings/05-private.py
- run: pytest /var/www/courtlistener/cl/corpus_importer/tests.py
Results in failure: pytest command not found.
docker:
- image: freelawproject/courtlistener-testing:0.1.0
command: while true; do date; sleep 60; done
steps:
- checkout
- run: rm -fr /var/www/courtlistener
- run: mv ~/project /var/www/courtlistener
- run: cp /var/www/courtlistener/cl/settings/05-private.example /var/www/courtlistener/cl/settings/05-private.py
- run: pytest /var/www/courtlistener/cl/corpus_importer/tests.py
Results in failure: Consider clearing entrypoint/command values and try again.
docker:
- image: freelawproject/courtlistener-testing:0.1.0
steps:
- checkout
- run: rm -fr /var/www/courtlistener
- run: mv ~/project /var/www/courtlistener
- run: cp /var/www/courtlistener/cl/settings/05-private.example /var/www/courtlistener/cl/settings/05-private.py
- run: /etc/init.d/postgresql start
- run: source /var/www/.virtualenvs/courtlistener/bin/activate && pytest /var/www/courtlistener/cl/corpus_importer/tests.py
But I don’t like this last approach because it’s not DRY. What config do I need to make the Dockerfile’s ENTRYPOINT work?
Thanks,