diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..cf85aa1fc7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.6 + +# Set up code directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Install Linux dependencies +RUN apt-get update && apt-get install -y libssl-dev + +# Copy over requirements +COPY setup.py . +COPY README.md . +COPY requirements-dev.txt . + +# Install python dependencies +RUN pip install -r requirements-dev.txt +RUN pip install -e . + +WORKDIR /code diff --git a/README.md b/README.md index 7fa942850c..2ba934e393 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,38 @@ pip install -r requirements-dev.txt pip install -e . ``` +## Using Docker + +If you would like to develop and test inside a docker environment, use the *sandbox* container provided in the **docker-compose.yml** file. + +To start up the test environment, run: + +``` +docker-compose up -d +``` + +This will build a docker container set up with an environment to run the Python test code. + +**Note: This container does not have `go-ethereum` installed, so you cannot run the go-ethereum test suite.** + +To run the Python tests from your local machine: + +``` +docker-compose exec sandbox bash -c 'pytest -n 4 -f -k "not goethereum"' +``` + +You can run arbitrary commands inside the docker container by using the `bash -c` prefix. + +``` +docker-compose exec sandbox bash -c '' +``` + +Or, if you would like to just open a session to the container, run: + +``` +docker-compose exec sandbox bash +``` + ### Testing Setup During development, you might like to have tests run on every file save. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..2ffdfaede2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + sandbox: + build: + context: . + volumes: + - .:/code + command: tail -f /dev/null