Skip to content

Commit

Permalink
Merge pull request #8 from sachk/master
Browse files Browse the repository at this point in the history
Make the docker container smaller and add documentation
  • Loading branch information
boynux authored Jul 30, 2018
2 parents 99fcb4d + 749e0bd commit b83f1d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM golang
FROM golang:alpine as builder

WORKDIR /go/src/github.com/boynux/squid-exporter
COPY . .

# Compile the binary statically, so it can be run without libraries.
RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' .

FROM alpine
COPY --from=0 /go/bin/squid-exporter /usr/local/bin/squid-exporter
FROM scratch
COPY --from=builder /go/bin/squid-exporter /usr/local/bin/squid-exporter

EXPOSE 9301

ENTRYPOINT ["/usr/local/bin/squid-exporter"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ To get all the parameteres
squid-exprter -help


Usage with docker:
------
Basic setup assuming Squid is running on the same machine:

docker run --net=host -d boynux/squid-exporter

Setup with Squid running on a different host

docker run -p 9301:9301 -d boynux/squid-exporter -squid-hostname "192.168.0.2" -squid-port 3128 -listen-address "0.0.0.0"

Features:
---------

Expand Down

0 comments on commit b83f1d4

Please sign in to comment.