Skip to content

Commit

Permalink
Add simple Dockerfile sandbox & docs (#294)
Browse files Browse the repository at this point in the history
* add dockerfile

* More docs

* docker

* more cleanup

* fix mkdir command

Co-authored-by: Bentley Breithaupt <[email protected]>

Co-authored-by: Bentley Breithaupt <[email protected]>
  • Loading branch information
Daniel B and Bentleysb authored Jul 27, 2020
1 parent 89026c3 commit e2cf984
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 11 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use base image: https://github.com/keeganwitt/docker-gradle
FROM gradle:jdk11

RUN mkdir -p /app/atlas-checks
COPY . /app/atlas-checks

ENTRYPOINT ["/app/atlas-checks/gradlew"]
16 changes: 5 additions & 11 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ There are a couple of requirements for building and running a new Atlas Check. T
- Some form of IDE
- There are multiple editors that you can use to help you build your Atlas Check. You can use text editors like [Notepad(++)](https://notepad-plus-plus.org/), [Vim](http://www.vim.org/download.php), [Emacs](https://www.gnu.org/software/emacs/) or [Sublime](https://www.sublimetext.com). Or you can use a full integrated development environment like [Intellij Idea](https://www.jetbrains.com/idea/) or [Eclipse](https://eclipse.org).

Alternatively, use the [Dockerfile](/Dockerfile) to create a development environment. See the docker
[documentation](/docs/docker.md) for installation instructions.


### Building Check Template
Building a check template is as easy as running a very basic command using gradle:
`./gradlew buildCheck -PCheckName=CheckName`
Expand Down Expand Up @@ -226,17 +230,7 @@ The properties of each flag will contain the following items:

### Currently Available Checks

- [PoolSizeCheck](tutorials/tutorial1-PoolSizeCheck.md)
- [BuildingRoadIntersectionCheck](checks/buildingRoadIntersectionCheck.md)
- [SelfIntersectingPolylineCheck](checks/selfIntersectingPolylineCheck.md)
- [FloatingEdgeCheck](checks/floatingEdgeCheck.md)
- [RoundAboutClosedLoopCheck](checks/roundaboutClosedLoopCheck.md)
- [SharpAngleCheck](checks/sharpAngleCheck.md)
- [SinkIslandCheck](tutorials/tutorial3-SinkIslandCheck.md)
- [SnakeRoadCheck](checks/snakeRoadCheck.md)
- [DuplicateNodeCheck](checks/duplicateNodeCheck.md)
- [OrphanNodeCheck](tutorials/tutorial2-OrphanNodeCheck.md)
- [InvalidTurnRestrictionCheck](checks/invalidTurnRestrictionCheck.md)
See the [checks catalog](/docs/available_checks.md) for a list and description of available checks.

** For Best Practices around writing Atlas Checks, please view our [best practices document](bestpractices.md). **

Expand Down
42 changes: 42 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Development - Docker

Use the [Dockerfile](/Dockerfile) to build a simple Docker container for development. The base image is derived from
[docker-gradle](https://github.com/keeganwitt/docker-gradle), a simple image that contains
both gradle (v6.4) and [adoptopenjdk11](https://github.com/AdoptOpenJDK/openjdk-docker).

## Installation and setup
Create docker image (in atlas-checks root).
```bash
docker build --rm --tag checks .
```

Create a docker container from the "checks" image. By default, the container exposes the gradle
wrapper (`gradlew`) script that invokes project's latest version of gradle. With this, you can
run the following commands: `run, build, buildCheck`
```bash
docker run [image name] [gradle command]
```


## Examples
Build the project (runs unit and integration tests).
```
docker run checks clean build
```

Run the default gradle run command. This will download a example pbf from geofabrik, execute the
atlas checks specified in the default configuration, and save the results to
`/app/atlas-checks/build/example/flag`

```
docker run checks run
```

Run the gradle run command using your local directory as the source. This is useful for local
development -- as changes to to the source code will be reflected when executing the command. Also,
outputs will be stored on your local machine.
```bash
docker run --mount type=bind,src=/path/to/local/atlas-checks,dst=/app/atlas-checks checks run \
-Pchecks.local.countries=AIA \
-Pchecks.local.checkFilter=SpikyBuildingCheck
```

0 comments on commit e2cf984

Please sign in to comment.