diff --git a/.travis.yml b/.travis.yml index 7d80c73..93f4ef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ go: script: - echo "Nginx Prometheus Exporter - commit:${TRAVIS_COMMIT}" - make test -- make container +- make container DOCKER_BUILDKIT=0; before_install: - echo "PR Slug:${TRAVIS_PULL_REQUEST_SLUG}" - if [[ "${TRAVIS_PULL_REQUEST_SLUG}" == "nginxinc/nginx-prometheus-exporter" || "${TRAVIS_PULL_REQUEST}" == "false" ]]; then diff --git a/Makefile b/Makefile index 466c8cf..2effac9 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,17 @@ VERSION = 0.5.0 -PREFIX = nginx/nginx-prometheus-exporter TAG = $(VERSION) +PREFIX = nginx/nginx-prometheus-exporter + +DOCKERFILEPATH = build +DOCKERFILE = Dockerfile + GIT_COMMIT = $(shell git rev-parse --short HEAD) BUILD_DIR = build_output -nginx-prometheus-exporter: test +export DOCKER_BUILDKIT = 1 + +nginx-prometheus-exporter: GO111MODULE=on CGO_ENABLED=0 go build -mod=vendor -installsuffix cgo -ldflags "-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT)" -o nginx-prometheus-exporter lint: @@ -15,7 +21,7 @@ test: GO111MODULE=on go test -mod=vendor ./... container: - docker build --build-arg VERSION=$(VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) -t $(PREFIX):$(TAG) . + docker build --build-arg VERSION=$(VERSION) --build-arg GIT_COMMIT=$(GIT_COMMIT) -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . push: container docker push $(PREFIX):$(TAG) diff --git a/Dockerfile b/build/Dockerfile similarity index 100% rename from Dockerfile rename to build/Dockerfile diff --git a/build/ci/Jenkinsfile b/build/ci/Jenkinsfile new file mode 100644 index 0000000..4afafa7 --- /dev/null +++ b/build/ci/Jenkinsfile @@ -0,0 +1,7 @@ +node { + git( + url: "${libsLocation}", + credentialsId: "${githubCreds}" + ) + load 'nginx-prometheus-exporter/Jenkinsfile' +} \ No newline at end of file