mage: streamline dockerfiles

This commit is contained in:
Cadey Ratio 2018-01-21 12:58:52 -08:00
parent c0c610af43
commit 28bf366c70
5 changed files with 18 additions and 12 deletions

View File

@ -1,9 +1,12 @@
FROM xena/go-mini:1.9.2 FROM xena/go-mini:1.9.2
RUN apk add alpine-sdk \ ENV CGO_ENABLED=0
RUN apk add git \
&& go download && go download
COPY . /root/go/src/git.xeserv.us/xena/route COPY . /root/go/src/git.xeserv.us/xena/route
RUN cd /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

View File

@ -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

View File

@ -73,9 +73,12 @@ func Docker() {
ver, err := gitTag() ver, err := gitTag()
qod.ANE(err) qod.ANE(err)
shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-core", "-f", "Dockerfile.core", ".") shouldWork(ctx, nil, wd, "docker", "build", "-t", "xena/route-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", ".") 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 // Linux builds binaries for linux

6
run/Dockerfile.agent Normal file
View File

@ -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

View File

@ -1,7 +1,7 @@
FROM xena/route-core FROM xena/route-core
FROM xena/alpine 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 VOLUME /routed