Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerize app #1

Merged
merged 1 commit into from
Dec 20, 2016
Merged
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
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