Replaced Dockerfile with two-stage process to build container with all tools
the build was successful
the build was successful
This commit is contained in:
+24
-4
@@ -1,6 +1,26 @@
|
||||
FROM alpine
|
||||
# Use Go 1.10
|
||||
FROM golang:1.10
|
||||
|
||||
COPY build/usr /usr
|
||||
COPY build/etc /etc
|
||||
# Load repository into docker
|
||||
WORKDIR /go/src/git.aiterp.net/rpdata/api/
|
||||
COPY . .
|
||||
|
||||
CMD ["/bin/sh"]
|
||||
# Load build tools and dependencies
|
||||
RUN go get -u github.com/golang/dep/cmd/dep
|
||||
RUN go get -u github.com/jteeuwen/go-bindata/...
|
||||
RUN dep ensure
|
||||
RUN go generate ./...
|
||||
|
||||
# Build server and tools (CGO disabled to make them 100% static)
|
||||
ENV CGO_ENABLED 0
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-graphiql ./cmd/rpdata-graphiql
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2charimport ./cmd/rpdata-lb2charimport
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2logimport ./cmd/rpdata-lb2logimport
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-wikifileimport ./cmd/rpdata-wikifileimport
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-ensurechannels ./cmd/rpdata-ensurechannels
|
||||
RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-as2storyimport ./cmd/rpdata-as2storyimport
|
||||
|
||||
# Move artifacts into final container
|
||||
FROM alpine:latest
|
||||
COPY --from=0 /binaries/* /usr/local/bin/
|
||||
CMD ["/usr/local/bin/rpdata-graphiql"]
|
||||
|
||||
Reference in New Issue
Block a user