Skip to content

Commit

Permalink
Add docker-compose for running sandbox environment
Browse files Browse the repository at this point in the history
Using this “sandbox” you can run everything inside of docker without
worrying about OS specific requirements.
  • Loading branch information
jasonrhaas committed Nov 18, 2017
1 parent 20752cc commit d956bdf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
sandbox:
build:
context: .
volumes:
- .:/code
command: tail -f /dev/null

0 comments on commit d956bdf

Please sign in to comment.