diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7447f89 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +/bin \ No newline at end of file diff --git a/Dockerfile.agent b/Dockerfile.agent new file mode 100644 index 0000000..374bade --- /dev/null +++ b/Dockerfile.agent @@ -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 diff --git a/Dockerfile.core b/Dockerfile.core new file mode 100644 index 0000000..fc76e06 --- /dev/null +++ b/Dockerfile.core @@ -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 diff --git a/Dockerfile.routed b/Dockerfile.routed new file mode 100644 index 0000000..030f2e8 --- /dev/null +++ b/Dockerfile.routed @@ -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 diff --git a/box.rb b/box.rb deleted file mode 100644 index 0e7ea00..0000000 --- a/box.rb +++ /dev/null @@ -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" diff --git a/mage.go b/mage.go index e0efb0d..0723e02 100644 --- a/mage.go +++ b/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) }