Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor image builds #67

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM debian:9.9-slim

EXPOSE 9436

COPY scripts/start.sh /app/
COPY dist/mikrotik-exporter_linux_amd64 /app/mikrotik-exporter

RUN chmod 755 /app/*

ENTRYPOINT ["/app/start.sh"]
FROM golang:1.13 AS builder
WORKDIR /go/src/app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build

FROM scratch
COPY --from=builder /go/src/app/mikrotik-exporter /mikrotik-exporter
ENTRYPOINT ["/mikrotik-exporter"]
14 changes: 7 additions & 7 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM arm64v8/busybox:1.31.0
FROM golang:1.13 AS builder
WORKDIR /go/src/app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build

EXPOSE 9090

COPY scripts/start.sh /app/
COPY dist/mikrotik-exporter_linux_arm64 /app/mikrotik-exporter

ENTRYPOINT ["/app/start.sh"]
FROM scratch
COPY --from=builder /go/src/app/mikrotik-exporter /mikrotik-exporter
ENTRYPOINT ["/mikrotik-exporter"]
18 changes: 8 additions & 10 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM arm32v7/busybox:1.27.2

EXPOSE 9090

COPY scripts/start.sh /app/
COPY dist/mikrotik-exporter_linux_arm /app/mikrotik-exporter

RUN chmod 755 /app/*

ENTRYPOINT ["/app/start.sh"]
FROM golang:1.13 AS builder
WORKDIR /go/src/app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm go build

FROM scratch
COPY --from=builder /go/src/app/mikrotik-exporter /mikrotik-exporter
ENTRYPOINT ["/mikrotik-exporter"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ deploy: utils
CGO_ENABLED=0 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
dockerhub:
@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)
Expand Down
15 changes: 0 additions & 15 deletions scripts/build-armhf.sh

This file was deleted.

15 changes: 0 additions & 15 deletions scripts/build.sh

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/start.sh

This file was deleted.