From c6deb9e05b7d2c8798e8d0c3e3fda13aadcf1a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E6=B5=B7?= Date: Mon, 10 Aug 2020 18:24:43 +0800 Subject: [PATCH] add dfget to supernode dockerfile --- Dockerfile | 2 +- Dockerfile.supernode | 6 +++++- hack/build.sh | 2 +- supernode/server/preheat_bridge.go | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d8aaea72..a3f57c4e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.10-alpine as builder +FROM golang:1.13.15-alpine as builder WORKDIR /go/src/github.com/dragonflyoss/Dragonfly RUN apk --no-cache add bash make gcc libc-dev git diff --git a/Dockerfile.supernode b/Dockerfile.supernode index abc84e41e..7621e0900 100644 --- a/Dockerfile.supernode +++ b/Dockerfile.supernode @@ -1,4 +1,4 @@ -FROM golang:1.12.10-alpine as builder +FROM golang:1.13.15-alpine as builder WORKDIR /go/src/github.com/dragonflyoss/Dragonfly RUN apk --no-cache add bash make gcc libc-dev git @@ -9,6 +9,7 @@ COPY . /go/src/github.com/dragonflyoss/Dragonfly # write the resulting executable to the dir /opt/dragonfly/df-supernode. ARG GOPROXY RUN make build-supernode && make install-supernode +RUN make build-client && make install-client FROM dragonflyoss/nginx:apline @@ -17,6 +18,9 @@ RUN apk --no-cache add ca-certificates bash COPY --from=builder /go/src/github.com/dragonflyoss/Dragonfly/hack/start-supernode.sh /root/start.sh COPY --from=builder /go/src/github.com/dragonflyoss/Dragonfly/hack/supernode-nginx.conf /etc/nginx/nginx.conf COPY --from=builder /opt/dragonfly/df-supernode/supernode /opt/dragonfly/df-supernode/supernode +COPY --from=builder /opt/dragonfly/df-client /opt/dragonfly/df-client +RUN ln -s /opt/dragonfly/df-client/dfget /usr/local/bin/dfget + # supernode will listen 8001,8002 in default. EXPOSE 8001 8002 diff --git a/hack/build.sh b/hack/build.sh index 928660573..7c2bccac0 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -8,7 +8,7 @@ DFDAEMON_BINARY_NAME=dfdaemon DFGET_BINARY_NAME=dfget SUPERNODE_BINARY_NAME=supernode PKG=github.com/dragonflyoss/Dragonfly -BUILD_IMAGE=golang:1.12.10 +BUILD_IMAGE=golang:1.13.15 VERSION=$(git describe --tags "$(git rev-list --tags --max-count=1)") REVISION=$(git rev-parse --short HEAD) DATE=$(date "+%Y%m%d-%H:%M:%S") diff --git a/supernode/server/preheat_bridge.go b/supernode/server/preheat_bridge.go index e2815f7ad..031bd1927 100644 --- a/supernode/server/preheat_bridge.go +++ b/supernode/server/preheat_bridge.go @@ -19,6 +19,7 @@ package server import ( "context" "net/http" + "time" "github.com/dragonflyoss/Dragonfly/apis/types" "github.com/dragonflyoss/Dragonfly/pkg/errortypes" @@ -60,8 +61,8 @@ func (s *Server) getPreheatTask(ctx context.Context, rw http.ResponseWriter, req } resp := types.PreheatInfo{ ID: task.ID, - FinishTime: strfmt.NewDateTime(), - StartTime: strfmt.NewDateTime(), + FinishTime: strfmt.DateTime(time.Unix(task.FinishTime/1000, task.FinishTime%1000*int64(time.Millisecond)).UTC()), + StartTime: strfmt.DateTime(time.Unix(task.StartTime/1000, task.StartTime%1000*int64(time.Millisecond)).UTC()), Status: task.Status, } return EncodeResponse(rw, http.StatusOK, resp)