mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
convert docker to alpine (#207)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,4 +10,4 @@ docs/_site
|
||||
powershell.log
|
||||
zones/
|
||||
*.env
|
||||
node_modules
|
||||
certs/
|
||||
|
10
Dockerfile
10
Dockerfile
@@ -1,13 +1,13 @@
|
||||
FROM golang:1.9 AS build-env
|
||||
FROM golang:1.9-alpine AS build-env
|
||||
WORKDIR /go/src/github.com/StackExchange/dnscontrol
|
||||
ADD . .
|
||||
RUN go run build/build.go
|
||||
RUN apk update && apk add git
|
||||
RUN go run build/build.go -os=linux
|
||||
RUN cp dnscontrol-Linux /go/bin/dnscontrol
|
||||
RUN dnscontrol version
|
||||
|
||||
FROM ubuntu:xenial
|
||||
FROM alpine
|
||||
COPY --from=build-env /go/bin/dnscontrol /usr/local/bin
|
||||
WORKDIR /dns
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y ca-certificates
|
||||
RUN dnscontrol version
|
||||
CMD dnscontrol
|
@@ -12,6 +12,8 @@ import (
|
||||
|
||||
var sha = flag.String("sha", "", "SHA of current commit")
|
||||
|
||||
var goos = flag.String("os", "", "OS to build (linux, windows, or darwin) Defaults to all.")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
flags := fmt.Sprintf(`-s -w -X main.SHA="%s" -X main.BuildTime=%d`, getVersion(), time.Now().Unix())
|
||||
@@ -29,9 +31,17 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
build("dnscontrol-Linux", "linux")
|
||||
build("dnscontrol.exe", "windows")
|
||||
build("dnscontrol-Darwin", "darwin")
|
||||
for _, env := range []struct {
|
||||
binary, goos string
|
||||
}{
|
||||
{"dnscontrol-Linux", "linux"},
|
||||
{"dnscontrol.exe", "windows"},
|
||||
{"dnscontrol-Darwin", "darwin"},
|
||||
} {
|
||||
if *goos == "" || *goos == env.goos {
|
||||
build(env.binary, env.goos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getVersion() string {
|
||||
|
Reference in New Issue
Block a user