diff --git a/Dockerfile b/Dockerfile index e99b9f1eb..57d7c0a41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,25 @@ -FROM golang:1.12.10-alpine as builder - -WORKDIR /go/src/github.com/dragonflyoss/Dragonfly -RUN apk --no-cache add bash make gcc libc-dev git - -COPY . /go/src/github.com/dragonflyoss/Dragonfly - -# make build dfdaemon and dfget. -# write the resulting executable to the dir /opt/dragonfly/df-client. -RUN make build-client && make install-client - -FROM alpine:3.8 - -RUN apk --no-cache add ca-certificates bash - -COPY --from=builder /opt/dragonfly/df-client /opt/dragonfly/df-client - -# dfdaemon will listen 65001 in default. -EXPOSE 65001 - -# use the https://index.docker.io as default registry. -CMD [ "--registry", "https://index.docker.io" ] - -ENTRYPOINT [ "/opt/dragonfly/df-client/dfdaemon" ] +FROM golang:1.12.10-alpine as builder + +WORKDIR /go/src/github.com/dragonflyoss/Dragonfly +RUN apk --no-cache add bash make gcc libc-dev git + +COPY . /go/src/github.com/dragonflyoss/Dragonfly + +# make build dfdaemon and dfget. +# write the resulting executable to the dir /opt/dragonfly/df-client. +ARG GOPROXY +RUN make build-client && make install-client + +FROM alpine:3.8 + +RUN apk --no-cache add ca-certificates bash + +COPY --from=builder /opt/dragonfly/df-client /opt/dragonfly/df-client + +# dfdaemon will listen 65001 in default. +EXPOSE 65001 + +# use the https://index.docker.io as default registry. +CMD [ "--registry", "https://index.docker.io" ] + +ENTRYPOINT [ "/opt/dragonfly/df-client/dfdaemon" ] diff --git a/Dockerfile.supernode b/Dockerfile.supernode index 0300e660b..abc84e41e 100644 --- a/Dockerfile.supernode +++ b/Dockerfile.supernode @@ -7,6 +7,7 @@ COPY . /go/src/github.com/dragonflyoss/Dragonfly # go build supernode. # write the resulting executable to the dir /opt/dragonfly/df-supernode. +ARG GOPROXY RUN make build-supernode && make install-supernode FROM dragonflyoss/nginx:apline diff --git a/hack/docker-build.sh b/hack/docker-build.sh index b65fe95d7..4c9272441 100755 --- a/hack/docker-build.sh +++ b/hack/docker-build.sh @@ -9,11 +9,11 @@ curDir=$(cd "$(dirname "$0")" && pwd) cd "${curDir}/../" || return docker-build::build-dfclient(){ - docker build -t dfclient:"${DF_VERSION}" -f Dockerfile . + docker build --build-arg GOPROXY="${GOPROXY}" -t dfclient:"${DF_VERSION}" -f Dockerfile . } docker-build::build-supernode(){ - docker build -t supernode:"${DF_VERSION}" -f Dockerfile.supernode . + docker build --build-arg GOPROXY="${GOPROXY}" -t supernode:"${DF_VERSION}" -f Dockerfile.supernode . } main() {