Skip to content

Commit

Permalink
feat: containerized dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
bertbesser committed Feb 21, 2021
1 parent d7f79f1 commit bdfc821
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ python -X tracemalloc -m unittest -f src/test/test_*
python -X tracemalloc -m unittest -f src/test/test_runner.py
```

To run tests in a dedicated container, see `dev/README.md`.

## Codestyle

Popper's code is formatted using the [black](https://github.com/psf/black) style. If code does not conform to this style, merges are prevented to the master and this is checked as a CI step.
Expand Down
1 change: 1 addition & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
5 changes: 5 additions & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.8-buster

RUN pip install --upgrade pip
RUN pip install setuptools setuptools_rust virtualenv

20 changes: 20 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Development environment

The following steps should be executed from within the folder `dev`.

To test popper, build the `popper-dev` image and prepare the folder to hold the venv
```
docker-compose build popper-dev
mkdir venv
```
then start the container and install deps into the venv
```
docker-compose run --rm popper-dev
# now you're insided the container
python -m virtualenv /venv
source /venv/bin/activate
pip install -e src/
```
From here on, you can always return to the container without having to re-install the venv.
However, don't forget to activate the venv after entering the container.
(The container is temporary and will be removed after you leave, so activate the venv each time.)
15 changes: 15 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.7'
services:
popper-dev:
image: popper-dev
container_name: popper-dev
stdin_open: true # docker run -i
tty: true # docker run -t
build:
context: .
command:
- bash
volumes:
- ${PWD}/..:/workspace
- ${PWD}/venv:/venv
working_dir: /workspace

0 comments on commit bdfc821

Please sign in to comment.