mage: streamline dockerfiles
This commit is contained in:
parent
c0c610af43
commit
28bf366c70
|
@ -1,9 +1,12 @@
|
|||
FROM xena/go-mini:1.9.2
|
||||
|
||||
RUN apk add alpine-sdk \
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
RUN apk add git \
|
||||
&& 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
|
||||
&& go run ./cmd/mage/main.go build \
|
||||
&& rm -rf /root/go/pkg /root/go/bin
|
|
@ -1,6 +0,0 @@
|
|||
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
|
9
mage.go
9
mage.go
|
@ -73,9 +73,12 @@ func Docker() {
|
|||
ver, err := gitTag()
|
||||
qod.ANE(err)
|
||||
|
||||
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-core", "-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", ".")
|
||||
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-core", ".")
|
||||
|
||||
run := filepath.Join(wd, "run")
|
||||
|
||||
shouldWork(ctx, nil, run, "docker", "build", "-t", "xena/routed:"+ver, "-f", "Dockerfile.routed", ".")
|
||||
shouldWork(ctx, nil, run, "docker", "build", "-t", "xena/route-httpagent:"+ver, "-f", "Dockerfile.agent", ".")
|
||||
}
|
||||
|
||||
// Linux builds binaries for linux
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
FROM xena/route-core
|
||||
FROM xena/alpine
|
||||
|
||||
COPY --from=0 /root/go/src/git.xeserv.us/xena/route/bin/linux/amd64/route-httpagent /usr/local/bin/route-httpagent
|
||||
|
||||
CMD /usr/local/bin/route-httpagent
|
|
@ -1,7 +1,7 @@
|
|||
FROM xena/route-core
|
||||
FROM xena/alpine
|
||||
|
||||
COPY --from=0 /root/go/bin/routed /usr/local/bin/routed
|
||||
COPY --from=0 /root/go/src/git.xeserv.us/xena/route/bin/linux/amd64/routed /usr/local/bin/routed
|
||||
|
||||
VOLUME /routed
|
||||
|
Loading…
Reference in New Issue