Skip to content

Commit

Permalink
Dockerize word_count example
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Jan 25, 2016
1 parent 4f962dd commit d382561
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM scratch


COPY glow /

EXPOSE 8930
VOLUME ["/data"]

ENTRYPOINT ["/glow"]
CMD [""]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ To understand how each executor works, you can visualize the flow by generating

![Glow Hello World Execution Plan](https://raw.githubusercontent.com/chrislusf/glow/master/etc/helloworld.png)

## Docker container

### OSX
Cross compile artefact for docker
```
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build .
```
Build container
```
docker build -t glow .
```
See `examples/` directory for docker-compose setups.

# Read More

Expand Down
1 change: 1 addition & 0 deletions examples/word_count/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
work/
7 changes: 7 additions & 0 deletions examples/word_count/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM scratch


COPY word_count /

ENTRYPOINT ["/word_count"]
CMD [""]
20 changes: 20 additions & 0 deletions examples/word_count/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Word count example

## Setup via docker-compose
* See [README](http://../../README.md#docker-container) to build `glow` docker image.
*

### OSX
Cross compile artefact for docker
```
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build .
```
Build container with `word_count` tag
```
docker build -t word_count .
```

Start containers via [docker-compose](https://docs.docker.com/compose/)
```
docker-compose up
```
40 changes: 40 additions & 0 deletions examples/word_count/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
agent1:
read_only: true
image: glow
command: agent --dir /data --max.executors=2 --memory=768 --master="master:8930" --port 8931
expose:
- "8931"
links:
- master
volumes:
- ./work/agent1:/data
- ./README.md:/etc/passwd

agent2:
read_only: true
image: glow
command: agent --dir /data --max.executors=2 --memory=768 --master="master:8930" --port 8932
expose:
- "8932"
links:
- master
volumes:
- ./work/agent2:/data
- ./README.md:/etc/passwd

master:
read_only: true
image: glow
command: master --ip 0.0.0.0
expose:
- "8930"

word_count:
image: word_count
command: -glow -test 1 -glow.leader="master:8930"
links:
- master
- agent1
- agent2
volumes:
- ./README.md:/etc/passwd

0 comments on commit d382561

Please sign in to comment.