helm/monocular

chart-repo docker build error

ns500 opened this issue · 2 comments

ns500 commented

Sending build context to Docker daemon 51.71kB
Step 1/10 : FROM golang:1.11 as builder
---> 2422e4d43e15
Step 2/10 : COPY . /go/src/github.com/helm/monocular
---> Using cache
---> 56f632874749
Step 3/10 : WORKDIR /go/src/github.com/helm/monocular
---> Using cache
---> 19854b5d2971
Step 4/10 : ARG VERSION
---> Using cache
---> 7528a73acc9e
Step 5/10 : RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X main.version=$VERSION" ./cmd/chart-repo
---> Running in eb3238f32a00
can't load package: package github.com/helm/monocular/cmd/chart-repo: cannot find package "github.com/helm/monocular/cmd/chart-repo" in any of:
/usr/local/go/src/github.com/helm/monocular/cmd/chart-repo (from $GOROOT)
/go/src/github.com/helm/monocular/cmd/chart-repo (from $GOPATH)
The command '/bin/sh -c CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X main.version=$VERSION" ./cmd/chart-repo' returned a non-zero code: 1

===================================================
Dockerfile :
FROM golang:1.11 as builder
COPY . /go/src/github.com/helm/monocular
WORKDIR /go/src/github.com/helm/monocular

ARG VERSION
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X main.version=$VERSION" ./cmd/chart-repo

FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/helm/monocular/chart-repo /chart-repo
USER 1001
CMD ["/chart-repo"]

How are you running the build? Have you tried running make -C cmd/chart-repo docker-build from the root of the repository?

ns500 commented

How are you running the build? Have you tried running make -C cmd/chart-repo docker-build from the root of the repository?

thanks,I can execute this command correctly.