Skip to content

Commit

Permalink
create dockerfile and add exporter to docker-compose for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick246 committed May 9, 2020
1 parent 562bd30 commit faf0445
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data
mongodb-query-exporter
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.13-alpine as builder
ENV CGO_ENABLED=0
WORKDIR /go/src/app
COPY go.* ./
RUN go mod download && go mod verify
COPY . .

RUN go build -ldflags="-s -w"

FROM scratch
LABEL maintainer="patrick246"
COPY --from=builder /etc/ssl/cert.pem /etc/ssl/cert.pem
COPY --from=builder /go/src/app/mongodb-query-exporter /mongodb-query-exporter

ENTRYPOINT ["/mongodb-query-exporter"]
EXPOSE 9736
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ services:
image: mongo
ports:
- 127.0.0.1:27017:27017
exporter:
image: repo.p246.dev/patrick246/mongodb-query-exporter:1.1.0
command: >-
--mongodb-uri=mongodb://mongodb:27017
--config-path=/data/*.json
ports:
- 127.0.0.1:9736:9736
volumes:
- ./data:/data:ro

0 comments on commit faf0445

Please sign in to comment.