From 83cbed45d8142463717e9ffe03ac2f26c5ddef58 Mon Sep 17 00:00:00 2001 From: Steve Brunton Date: Sun, 16 Dec 2018 23:28:05 -0500 Subject: [PATCH] CircleCI build to DockerHub too Also as part of the CircleCI build create a container and push to docker hub. --- .circleci/config.yml | 4 +++- Dockerfile | 2 +- Dockerfile.armhf | 2 +- Makefile | 9 +++++++-- VERSION | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac8360e..dbb8c4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,4 +10,6 @@ jobs: - /^nshttpd.*/ steps: - checkout - - run: make deploy \ No newline at end of file + - setup_remote_docker: + version: 18.05.0-ce + - run: make dockerhub diff --git a/Dockerfile b/Dockerfile index 6885b1e..bb830ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:3.6 EXPOSE 9436 COPY scripts/start.sh /app/ -COPY mikrotik-exporter /app/ +COPY dist/mikrotik-exporter_linux_amd64 /app/ RUN chmod 755 /app/* diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 95f2e05..b086239 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -3,7 +3,7 @@ FROM arm32v7/busybox:1.27.2 EXPOSE 9090 COPY scripts/start.sh /app/ -COPY mikrotik-exporter /app/ +COPY dist/mikrotik-exporter_linux_arm /app/ RUN chmod 755 /app/* diff --git a/Makefile b/Makefile index ef8bf5f..92a04d5 100644 --- a/Makefile +++ b/Makefile @@ -14,5 +14,10 @@ utils: go get github.com/tcnksm/ghr deploy: utils - gox -parallel=4 -ldflags "$(LDFLAGS)" -output "dist/mikrotik-exporter_{{.OS}}_{{.Arch}}" - ghr -t $(GITHUB_TOKEN) -u $(CIRCLE_PROJECT_USERNAME) -r $(CIRCLE_PROJECT_REPONAME) -replace $(VERSION) dist/ \ No newline at end of file + gox -os="linux freebsd netbsd" -arch="amd64 arm arm64 386" -parallel=4 -ldflags "$(LDFLAGS)" -output "dist/mikrotik-exporter_{{.OS}}_{{.Arch}}" + ghr -t $(GITHUB_TOKEN) -u $(CIRCLE_PROJECT_USERNAME) -r $(CIRCLE_PROJECT_REPONAME) -replace $(VERSION) dist/ + +dockerhub: deploy + @docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) + docker build -t $(CIRCLE_PROJECT_USERNAME)/$(CIRCLE_PROJECT_REPONAME):$(VERSION) . + docker push $(CIRCLE_PROJECT_USERNAME)/$(CIRCLE_PROJECT_REPONAME):$(VERSION) diff --git a/VERSION b/VERSION index 720e407..21e8796 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2-DEVEL +1.0.3