diff options
author | Daniel Quinn | 2022-11-20 18:17:09 +0000 |
---|---|---|
committer | GitHub | 2022-11-20 11:17:09 -0700 |
commit | a43ccde8d99afb0cf58dec07e79dcc502ab790eb (patch) | |
tree | 3cbdc9959643e9e309dd2c25119c5dd6ca36b943 | |
parent | f8f4fa8665ef61caf5266c980046305f3b779c6d (diff) | |
download | takahe-a43ccde8d99afb0cf58dec07e79dcc502ab790eb.tar.gz takahe-a43ccde8d99afb0cf58dec07e79dcc502ab790eb.tar.bz2 takahe-a43ccde8d99afb0cf58dec07e79dcc502ab790eb.zip |
Document Docker development (#21)
This also mounts the project root at /takahe/ to make development possible.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 54 | ||||
-rw-r--r-- | docker/docker-compose.yml | 2 |
3 files changed, 46 insertions, 12 deletions
@@ -5,3 +5,5 @@ /docs/_build /media/ notes.md +__pycache__/ +*.pyc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c77767..451d7d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,33 +2,63 @@ ## Getting Started -Takahē requires Python 3.11 +Development can be done "bare metal" or with Docker. We'll describe both here. -Create and activate a virtual environment -``` -python3 -m venv .venv -. .venv/bin/activate -``` +### Bare Metal -Install the development requirements: +Takahē requires Python 3.11, so you'll need that first. Then, create and +activate a virtual environment: +```shell +$ python3 -m venv .venv +$ . .venv/bin/activate ``` -pip install -r requirements-dev.txt + +You can install the development requirements: + +```shell +$ pip install -r requirements-dev.txt ``` -Enable git commit hooks: +...and enable git commit hooks if you like: ```bash -pre-commit install +$ pre-commit install ``` -Try running the tests: +Finally, you can run the tests with PyTest: ```bash -pytest +$ pytest ``` + +### Docker + +The docker build process will take care of much of the above, but you just have +to be sure that you're executing it from the project root. + +First, you need to build your image: + +```shell +$ docker build -f ./docker/Dockerfile -t "takahe:latest" . +``` + +Then start the `compose` session: + +```shell +$ docker compose -f docker/docker-compose.yml up +``` + +Once your session is up and running, you can run the tests inside your +container: + +```shell +$ docker compose -f docker/docker-compose.yml exec web pytest +``` + + # Code of Conduct As a contributor, you can help us keep the Takahē community open and inclusive. Takahē diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 099b027..2e6620a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -37,6 +37,8 @@ services: - db ports: - "8000:8000" + volumes: + - ../:/takahe/ networks: internal_network: |