You can install Docker CE for your platform at https://docker.com.
Get the code¶
git clone firstname.lastname@example.org:mozmeao/basket.git
Settings are injected into the Docker container environment via the .env file. You can
get started by copying
.env and that will
provide the basics you need to run the site and the tests.
Install pre-commit, and then run
pre-commit install and you’ll be setup to auto format your
code according to our style and check for errors for every commit.
The steps to get up and running are these:
$ # this pulls our latest builds from the docker hub. $ # it's optional but will speed up your builds considerably. $ docker-compose pull $ # this starts the server and dependencies $ docker-compose up web
If you’ve made changes to the Dockerfile or requirements.txt you’ll need to rebuild the image to run the app and tests:
$ docker-compose build web
Then to run the app you run the docker-compose up web command again, or for running tests against your local changes you run:
$ docker-compose run --rm test
We use pytest for running tests. So if you’d like to craft your own pytest command to run individual test files or something you can do so by passing in a command to the above:
$ docker-compose run --rm test py.test basket/news/tests/test_views.py
And if you need to debug a running container, you can open another terminal to your basket code and run the following:
$ docker-compose exec web bash $ # or $ docker-compose exec web python manage.py shell