Skip to content

Commit

Permalink
add build section to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bcicen committed Mar 19, 2017
1 parent 2b23388 commit 82677d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
29 changes: 2 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,7 @@ docker run -ti --name ctop --rm -v /var/run/docker.sock:/var/run/docker.sock qua

## Building

To build `ctop` from source, ensure you have a recent version of [glide](https://github.com/Masterminds/glide) installed and run:

```bash
git clone https://github.com/bcicen/ctop.git $GOPATH/src/github.com/bcicen/ctop && \
cd $GOPATH/src/github.com/bcicen/ctop && \
make build
```

To build a minimal Docker image containing only `ctop`, follow the build instructions above up through `glide install`, then:

```bash
CGO_ENABLED=0 go build -a
[[ ! -d docker-build ]] && mkdir docker-build
cd docker-build && cp ../ctop ./
cat > Dockerfile <<- "EOF"
FROM scratch
COPY ./ctop /ctop
ENTRYPOINT ["/ctop"]
EOF
docker build -t ctop .
```

Now you can run ctop as above:

```bash
docker run -ti --name ctop --rm -v /var/run/docker.sock:/var/run/docker.sock ctop
```
Build steps can be found [here][build].

## Usage

Expand Down Expand Up @@ -102,4 +76,5 @@ s | Select container sort field
r | Reverse container sort order
q | Quit ctop

[build]: _docs/build.md
[expanded_view]: _docs/expanded.md
20 changes: 20 additions & 0 deletions _docs/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Build

To build `ctop` from source, ensure you have a recent version of [glide](https://github.com/Masterminds/glide) installed and run:

```bash
go get github.com/bcicen/ctop && \
cd $GOPATH/src/github.com/bcicen/ctop && \
make build
```

To build a minimal Docker image containing only `ctop`:
```bash
make image
```

Now you can run your local image:

```bash
docker run -ti --name ctop --rm -v /var/run/docker.sock:/var/run/docker.sock ctop
```

0 comments on commit 82677d5

Please sign in to comment.