Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
docker builds 1.12, from scratch
  • Loading branch information
benclapp committed Jun 4, 2019
commit 122e30fd3fdf6eb2f261724947a8a4d31c2bb518
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
azure_sql_exporter
dist/
config/
config.yaml
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM golang:1.10 as build-env
FROM alpine:latest as certificates
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates


FROM golang:1.12 as builder
ADD . /go/src/github.com/iamseth/azure_sql_exporter
WORKDIR /go/src/github.com/iamseth/azure_sql_exporter
RUN make
RUN mv dist/azure_sql_exporter* dist/azure_sql_exporter
RUN CGO_ENABLED=0 go build -ldflags "-X main.Version=$(cat VERSION)"

FROM scratch

# Copy certs from alpine as they don't exist from scratch
COPY --from=certificates /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/iamseth/azure_sql_exporter/azure_sql_exporter /app/

FROM debian:latest
WORKDIR /app
COPY --from=build-env /go/src/github.com/iamseth/azure_sql_exporter/dist/azure_sql_exporter /app/
VOLUME [ "/config" ]
ENTRYPOINT /app/azure_sql_exporter -config.file=/config/config.yaml
ENTRYPOINT ["/app/azure_sql_exporter"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 0.1.0
VERSION := 0.1.1

LDFLAGS := -X main.Version=$(VERSION)
GOFLAGS := -ldflags "$(LDFLAGS)"
Expand Down Expand Up @@ -26,4 +26,4 @@ format:

.PHONY: docker
docker:
docker run --rm -v "$$PWD":/go/src/github.com/iamseth/azure_sql_exporter -w /go/src/github.com/iamseth/azure_sql_exporter golang:1.6 bash -c make
docker build -t benclapp/azure_sql_exporter:$(VERSION) -t benclapp/azure_sql_exporter:latest .
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.1