mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-22 06:55:41 +00:00
Fix docker build steps.
Docker 1.12 completely broke setting entrypoints on import, so we need to switch to using an actual Dockerfile.
This commit is contained in:
parent
39bd5d3938
commit
5fec9aacab
@ -3,7 +3,7 @@ services:
|
|||||||
- docker
|
- docker
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- '1.6'
|
- '1.7'
|
||||||
script:
|
script:
|
||||||
- make all
|
- make all
|
||||||
- make docker
|
- make docker
|
||||||
|
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY postgres_exporter /postgres_exporter
|
||||||
|
|
||||||
|
EXPOSE 9113
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/postgres_exporter" ]
|
18
Makefile
18
Makefile
@ -11,9 +11,7 @@ postgres_exporter: $(GO_SRC)
|
|||||||
|
|
||||||
# Take a go build and turn it into a minimal container
|
# Take a go build and turn it into a minimal container
|
||||||
docker: postgres_exporter
|
docker: postgres_exporter
|
||||||
tar -cf - postgres_exporter | docker import --change "EXPOSE 9113" \
|
docker build -t $(CONTAINER_NAME) .
|
||||||
--change 'ENTRYPOINT [ "/postgres_exporter" ]' \
|
|
||||||
- $(CONTAINER_NAME)
|
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet .
|
go vet .
|
||||||
@ -24,15 +22,15 @@ test:
|
|||||||
test-integration:
|
test-integration:
|
||||||
tests/test-smoke
|
tests/test-smoke
|
||||||
|
|
||||||
# Do a self-contained docker build - we pull the official upstream container,
|
# Do a self-contained docker build - we pull the official upstream container
|
||||||
# then template out a dockerfile which builds the real image.
|
# and do a self-contained build.
|
||||||
docker-build: postgres_exporter
|
docker-build: postgres_exporter
|
||||||
docker run -v $(shell pwd):/go/src/github.com/wrouesnel/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 \
|
-w /go/src/github.com/wrouesnel/postgres_exporter \
|
||||||
golang:1.6-wheezy \
|
golang:1.7-wheezy \
|
||||||
/bin/bash -c "make >&2 && tar -cf - ./postgres_exporter" | \
|
/bin/bash -c "make >&2 && chown $$SHELL_UID:$$SHELL_GID ./postgres_exporter"
|
||||||
docker import --change "EXPOSE 9113" \
|
docker build -t $(CONTAINER_NAME) .
|
||||||
--change 'ENTRYPOINT [ "/postgres_exporter" ]' \
|
|
||||||
- $(CONTAINER_NAME)
|
|
||||||
|
|
||||||
.PHONY: docker-build docker test vet
|
.PHONY: docker-build docker test vet
|
||||||
|
Loading…
Reference in New Issue
Block a user