mage: build images with docker build
This commit is contained in:
parent
d0695adfb6
commit
51aeab0a13
|
@ -0,0 +1 @@
|
|||
/bin
|
|
@ -0,0 +1,6 @@
|
|||
FROM xena/route-core
|
||||
FROM xena/alpine
|
||||
|
||||
COPY --from=0 /root/go/bin/route-httpagent /usr/local/bin/route-httpagent
|
||||
|
||||
CMD /usr/local/bin/route-httpagent
|
|
@ -0,0 +1,9 @@
|
|||
FROM xena/go-mini:1.9.2
|
||||
|
||||
RUN apk add alpine-sdk \
|
||||
&& go download
|
||||
|
||||
COPY . /root/go/src/git.xeserv.us/xena/route
|
||||
|
||||
RUN cd /root/go/src/git.xeserv.us/xena/route \
|
||||
&& go run ./cmd/mage/main.go build
|
|
@ -0,0 +1,10 @@
|
|||
FROM xena/route-core
|
||||
FROM xena/alpine
|
||||
|
||||
COPY --from=0 /root/go/bin/routed /usr/local/bin/routed
|
||||
|
||||
VOLUME /routed
|
||||
|
||||
ENV BOLTDB_PATH /routed/route.db
|
||||
|
||||
CMD /usr/local/bin/routed
|
30
box.rb
30
box.rb
|
@ -1,30 +0,0 @@
|
|||
$goVer = "1.9.2"
|
||||
$repoPath = "git.xeserv.us/xena/route"
|
||||
|
||||
from "xena/go-mini:#{$goVer}"
|
||||
|
||||
run "go#{$goVer} download"
|
||||
|
||||
[
|
||||
"vendor",
|
||||
"internal",
|
||||
"proto",
|
||||
"cmd",
|
||||
].each { |x| copy x+"/", "/root/go/src/#{$repoPath}/#{x}" }
|
||||
|
||||
run "apk --no-cache add build-base"
|
||||
run "go#{$goVer} build -v #{$repoPath}/cmd/... && go#{$goVer} install -v #{$repoPath}/cmd/..."
|
||||
run "apk del build-base"
|
||||
|
||||
[
|
||||
"route-cli",
|
||||
"routed",
|
||||
"route-httpagent",
|
||||
].each { |x| run "cp /root/go/bin/#{x} /usr/local/bin/#{x}" }
|
||||
|
||||
tag "xena/route:thick"
|
||||
|
||||
run "apk del go#{$goVer} && rm -rf /root/sdk /root/go"
|
||||
flatten
|
||||
|
||||
tag "xena/route:latest"
|
8
mage.go
8
mage.go
|
@ -62,9 +62,9 @@ func Docker() {
|
|||
ver, err := gitTag()
|
||||
qod.ANE(err)
|
||||
|
||||
shouldWork(ctx, nil, wd, "box", "box.rb")
|
||||
shouldWork(ctx, nil, wd, "docker", "tag", "xena/route:latest", "xena/route:"+ver)
|
||||
shouldWork(ctx, nil, wd, "docker", "tag", "xena/route:thick", "xena/route:thick-"+ver)
|
||||
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-core:"+ver, "-f", "Dockerfile.core", ".")
|
||||
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/routed:"+ver, "-f", "Dockerfile.routed", ".")
|
||||
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-httpagent:"+ver, "-f", "Dockerfile.agent", ".")
|
||||
}
|
||||
|
||||
// Linux builds binaries for linux
|
||||
|
@ -184,8 +184,8 @@ func Generate(ctx context.Context) {
|
|||
|
||||
// Vars shows the various variables that this magefile uses.
|
||||
func Vars() {
|
||||
qod.Printlnf("arches:\t%v", arches)
|
||||
qod.Printlnf("goarch:\t%s", runtime.GOARCH)
|
||||
qod.Printlnf("goos:\t%s", runtime.GOOS)
|
||||
qod.Printlnf("arches:\t%v", arches)
|
||||
qod.Printlnf("wd:\t%s", wd)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue