Skip to content
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
- docker
language: go
go:
- '1.6'
- '1.7'
script:
- make all
- make docker
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM scratch

COPY postgres_exporter /postgres_exporter

EXPOSE 9113

ENTRYPOINT [ "/postgres_exporter" ]
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ postgres_exporter: $(GO_SRC)

# Take a go build and turn it into a minimal container
docker: postgres_exporter
tar -cf - postgres_exporter | docker import --change "EXPOSE 9113" \
--change 'ENTRYPOINT [ "/postgres_exporter" ]' \
- $(CONTAINER_NAME)
docker build -t $(CONTAINER_NAME) .

vet:
go vet .
Expand All @@ -24,15 +22,15 @@ test:
test-integration:
tests/test-smoke

# Do a self-contained docker build - we pull the official upstream container,
# then template out a dockerfile which builds the real image.
# Do a self-contained docker build - we pull the official upstream container
# and do a self-contained build.
docker-build: postgres_exporter
docker run -v $(shell pwd):/go/src/github.com/wrouesnel/postgres_exporter \
-v $(shell pwd):/real_src \
-e SHELL_UID=$(shell id -u) -e SHELL_GID=$(shell id -g) \
-w /go/src/github.com/wrouesnel/postgres_exporter \
golang:1.6-wheezy \
/bin/bash -c "make >&2 && tar -cf - ./postgres_exporter" | \
docker import --change "EXPOSE 9113" \
--change 'ENTRYPOINT [ "/postgres_exporter" ]' \
- $(CONTAINER_NAME)
golang:1.7-wheezy \
/bin/bash -c "make >&2 && chown $$SHELL_UID:$$SHELL_GID ./postgres_exporter"
docker build -t $(CONTAINER_NAME) .

.PHONY: docker-build docker test vet