kaspad/docker/Dockerfile
Svarog 35546b62d0
[DEV-240] Style fixes to satisfy golint (#112)
* [DEV-240] Unexport BlockDAG/SelectedTip, since it returns unexported *blockNode

* [DEV-240] Fix blockdag package comment to satisfy golint

* [DEV-240] Add comment explaining blank import of ffldb in blockdag/test_utils.go

* [DEV-240] Add comment to FullUTXOSet.Get

* [DEV-240] Unexported config.DefaultHomeDir

* [DEV-240] Remove blank import of ffldb from config/config.go

* [DEV-240] Added comment to daghash.Strings()

* [DEV-240] Added missing comments in hdkeychain/extendedkey.go

* [DEV-240] Re-activate goline in CI Dockerfile

* [DEV-240] Fixed some typos in comments

* [DEV-240] Typo fix in comment
2018-11-05 12:58:17 +02:00

46 lines
1.3 KiB
Docker

# -- multistage docker build: stage #1: build stage
FROM golang:1.10-alpine AS build
RUN mkdir -p /go/src/github.com/daglabs/btcd
WORKDIR /go/src/github.com/daglabs/btcd
RUN apk add --no-cache curl git openssh binutils gcc musl-dev
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN go get -u github.com/golang/lint/golint \
github.com/kisielk/errcheck \
github.com/opennota/check/cmd/aligncheck \
github.com/opennota/check/cmd/structcheck \
github.com/opennota/check/cmd/varcheck
COPY ./Gopkg.* ./
RUN dep ensure -v -vendor-only
COPY . .
RUN TEST_DIRS=`go list -f {{.Dir}} ./... | grep -v /vendor/`
RUN GOFMT_RESULT=`gofmt -l $TEST_DIRS`; echo $GOFMT_RESULT; test -z "$GOFMT_RESULT"
RUN go vet ./...
RUN golint -set_exit_status $TEST_DIRS
# RUN aligncheck ./...
# RUN structcheck -e ./...
# RUN varcheck -e ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o btcd .
# Remove the line below and uncomment the line after it for testing with coverage
RUN go test -gcflags='-l' ./...
# RUN ./test.sh
# --- multistage docker build: stage #2: runtime image
FROM alpine
WORKDIR /app
RUN apk add --no-cache ca-certificates tini
COPY --from=build /go/src/github.com/daglabs/btcd/btcd /app/
COPY --from=build /go/src/github.com/daglabs/btcd/version.txt /app/
USER nobody
ENTRYPOINT [ "/sbin/tini", "--" ]