diff --git a/Dockerfile b/Dockerfile index 472b3f1..324296d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10 +FROM golang:1.10 AS builder RUN mkdir -p /go/src/app WORKDIR /go/src/app @@ -7,8 +7,11 @@ ARG ROOT_IMPORT_PATH=github.com/icedream/embot COPY . /go/src/app RUN \ mkdir -p "$GOPATH/src/$(dirname "$ROOT_IMPORT_PATH")" &&\ - ln -sf /go/src/app "$GOPATH/src/$ROOT_IMPORT_PATH" &&\ - go-wrapper download &&\ - go-wrapper install + ln -sf "$GOPATH/src/app" "$GOPATH/src/$ROOT_IMPORT_PATH" &&\ + CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o /soccerbot "$ROOT_IMPORT_PATH" -CMD ["go-wrapper", "run"] +### + +FROM scratch +COPY --from=builder /soccerbot / +ENTRYPOINT ["/soccerbot"]