Document Docker development (#21)
This also mounts the project root at /takahe/ to make development possible.
This commit is contained in:
parent
f8f4fa8665
commit
a43ccde8d9
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
/docs/_build
|
/docs/_build
|
||||||
/media/
|
/media/
|
||||||
notes.md
|
notes.md
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
@ -2,33 +2,63 @@
|
|||||||
|
|
||||||
## Getting Started
|
## 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
|
|
||||||
|
|
||||||
```
|
### Bare Metal
|
||||||
python3 -m venv .venv
|
|
||||||
. .venv/bin/activate
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
Install the development requirements:
|
You can install the development requirements:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
pip install -r requirements-dev.txt
|
$ pip install -r requirements-dev.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
Enable git commit hooks:
|
...and enable git commit hooks if you like:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pre-commit install
|
$ pre-commit install
|
||||||
```
|
```
|
||||||
|
|
||||||
Try running the tests:
|
Finally, you can run the tests with PyTest:
|
||||||
|
|
||||||
```bash
|
```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
|
# Code of Conduct
|
||||||
|
|
||||||
As a contributor, you can help us keep the Takahē community open and inclusive. Takahē
|
As a contributor, you can help us keep the Takahē community open and inclusive. Takahē
|
||||||
|
@ -37,6 +37,8 @@ services:
|
|||||||
- db
|
- db
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ../:/takahe/
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal_network:
|
internal_network:
|
||||||
|
Reference in New Issue
Block a user