[NOD-119] Add a call to "go mod download" before copying all files in Dockerfiles. (#255)

This commit is contained in:
stasatdaglabs 2019-04-18 17:20:58 +03:00 committed by Ori Newman
parent b612426ead
commit 311c96122e
4 changed files with 28 additions and 8 deletions

View File

@ -12,12 +12,17 @@ RUN go get -u golang.org/x/lint/golint \
github.com/opennota/check/cmd/structcheck \
github.com/opennota/check/cmd/varcheck
COPY . .
# GO111MODULE=on forces Go to use the go-module system
# TODO: remove this once Go 1.13 is released
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go vet ./...
# RUN aligncheck ./...
# RUN structcheck -e ./...

View File

@ -12,12 +12,17 @@ RUN go get -u golang.org/x/lint/golint \
github.com/opennota/check/cmd/structcheck \
github.com/opennota/check/cmd/varcheck
COPY . .
# GO111MODULE=on forces Go to use the go-module system
# TODO: remove this once Go 1.13 is released
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN TEST_DIRS=`go list -f {{.Dir}} ./... | grep -v /vendor/` GOFMT_RESULT=`gofmt -l $TEST_DIRS`; echo $GOFMT_RESULT; test -z "$GOFMT_RESULT"
RUN go vet ./...
RUN TEST_DIRS=`go list -f {{.Dir}} ./... | grep -v /vendor/` golint -set_exit_status $TEST_DIRS

View File

@ -12,12 +12,17 @@ RUN apk add --no-cache libc6-compat
RUN go get github.com/derekparker/delve/cmd/dlv
COPY . .
# GO111MODULE=on forces Go to use the go-module system
# TODO: remove this once Go 1.13 is released
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -gcflags "all=-N -l" -a -installsuffix cgo -o btcd .
ENTRYPOINT [ "/sbin/tini", "--" ]

View File

@ -7,12 +7,17 @@ WORKDIR /go/src/github.com/daglabs/btcd
RUN apk add --no-cache curl git
COPY . .
# GO111MODULE=on forces Go to use the go-module system
# TODO: remove this once Go 1.13 is released
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN cd mining/simulator && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o mining_simulator .
# --- multistage docker build: stage #2: runtime image