File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ services:
33- docker
44language : go
55go :
6- - ' 1.6 '
6+ - ' 1.7 '
77script :
88- make all
99- make docker
Original file line number Diff line number Diff line change 1+ FROM scratch
2+
3+ COPY postgres_exporter /postgres_exporter
4+
5+ EXPOSE 9113
6+
7+ ENTRYPOINT [ "/postgres_exporter" ]
Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ postgres_exporter: $(GO_SRC)
1111
1212# Take a go build and turn it into a minimal container
1313docker : postgres_exporter
14- tar -cf - postgres_exporter | docker import --change " EXPOSE 9113" \
15- --change ' ENTRYPOINT [ "/postgres_exporter" ]' \
16- - $(CONTAINER_NAME )
14+ docker build -t $(CONTAINER_NAME ) .
1715
1816vet :
1917 go vet .
@@ -24,15 +22,15 @@ test:
2422test-integration :
2523 tests/test-smoke
2624
27- # Do a self-contained docker build - we pull the official upstream container,
28- # then template out a dockerfile which builds the real image .
25+ # Do a self-contained docker build - we pull the official upstream container
26+ # and do a self-contained build .
2927docker-build : postgres_exporter
3028 docker run -v $(shell pwd) :/go/src/github.com/wrouesnel/postgres_exporter \
29+ -v $(shell pwd) :/real_src \
30+ -e SHELL_UID=$(shell id -u) -e SHELL_GID=$(shell id -g) \
3131 -w /go/src/github.com/wrouesnel/postgres_exporter \
32- golang:1.6-wheezy \
33- /bin/bash -c " make >&2 && tar -cf - ./postgres_exporter" | \
34- docker import --change " EXPOSE 9113" \
35- --change ' ENTRYPOINT [ "/postgres_exporter" ]' \
36- - $(CONTAINER_NAME )
32+ golang:1.7-wheezy \
33+ /bin/bash -c " make >&2 && chown $$ SHELL_UID:$$ SHELL_GID ./postgres_exporter"
34+ docker build -t $(CONTAINER_NAME ) .
3735
3836.PHONY : docker-build docker test vet
You can’t perform that action at this time.
0 commit comments