Skip to content

Commit

Permalink
Merge pull request #1 from gianrubio/branch/dockerize
Browse files Browse the repository at this point in the history
dockerize app
  • Loading branch information
sysulq authored Dec 20, 2016
2 parents 0eaaf00 + f176235 commit 81f4b06
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.*
vendor
Dockerfile
Makefile
README.md
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM golang:alpine

#RUN apt-get update &&\
# rm -rf /var/lib/apt/lists
RUN apk --no-cache --update add git ca-certificates
WORKDIR $GOPATH/src/app/
ADD . .
RUN go get -v
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o nginx-vts-exporter .
RUN mv $GOPATH/src/app/nginx-vts-exporter /
COPY ./docker-entrypoint.sh /

EXPOSE 9113

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/nginx-vts-exporter"]
#, "-nginx.scrape_uri=http://localhost/status/format/json"]

#CMD ["$GOPATH/src/app/nginx-vts-exporter"]
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,22 @@ Run
---
```
nohup ./nginx-vts-exporter -nginx.scrape_uri=http://localhost/status/format/json
```
```

Dockerize
--

Build
```
docker build -t vts-export .
```
Run
```
docker run -ti vts-export
```

Run with args
```
docker run -ti vts-export -nginx.scrape_uri=http://localhost/status/format/json
```

10 changes: 10 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eo pipefail

# If there are any arguments then we want to run those instead
if [[ "$1" == "/nginx-vts-exporter" || -z $1 ]]; then
exec "$@"
#$GOPATH/src/app/nginx-vts-exporter
else
exec "/nginx-vts-exporter" "$@"
fi

0 comments on commit 81f4b06

Please sign in to comment.