Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
docker-stats-on-exit-shim

# Vim swap files
.*.swp
.gitignore
.travis.yml
Dockerfile
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM golang:1.12 as builder
RUN go get -u github.com/golang/dep/...

WORKDIR $GOPATH/src/github.com/delcypher/docker-stats-on-exit-shim

COPY Gopkg.toml .
COPY main.go .

RUN dep ensure

RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /docker-stats-on-exit-shim

FROM alpine:latest

WORKDIR /

COPY --from=builder /docker-stats-on-exit-shim .
ENTRYPOINT ["/docker-stats-on-exit-shim", "/dev/stdout"]
CMD ["sleep", "1"]
4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[[override]]
name = "github.com/opencontainers/runc"
revision = "a2a6e82"
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ to gather their statistics. It dumps these statistics to a file as JSON and then
with the exit code of the real command.

## Example

Dockerfile
```
COPY --from=hasnat/docker-stats-on-exit-shim /docker-stats-on-exit-shim .
ENTRYPOINT ["/docker-stats-on-exit-shim", "/dev/stdout"]
CMD ["sleep", "1"]
```
Example Run
```bash
$ docker run --rm -ti -v`pwd`:/tmp/:rw ubuntu /tmp/docker-stats-on-exit-shim /tmp/output.json /bin/sleep 1
$ cat output.json
$ docker run --rm -ti hasnat/docker-stats-on-exit-shim /bin/sleep 1
```
Output example
```json
{
"wall_time": 1000765975,
Expand Down Expand Up @@ -53,10 +59,7 @@ $ cat output.json
mkdir -p src/github.com/delcypher
export GOPATH=`pwd`
cd src/github.com/delcypher
git clone [email protected]:delcypher/docker-stats-on-exit-shim.git
cd docker-stats-on-exit-shim
git submodule init && git submodule update
go get .
dep ensure
go build
```

Expand Down
1 change: 0 additions & 1 deletion vendor/github.com/opencontainers/runc
Submodule runc deleted from a2a6e8