Closed rvojcik closed 4 years ago
Hi @rvojcik !!
This is how I build the docker image:
GO111MODULE=on DOCKER_REGISTRY="<my-docker-registry/repo>" make docker-build
How are you building it?
Thanks!
Hi, sorry for delay.
I just run docker build
so it builds inside docker container as it's specified in Dockerfile.
It uses go 1.12 image
# Build the manager binary
FROM golang:1.12.5 as builder
and build
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "-X main.version=${SECRETS_MANAGER_VERSION}" -a -o secrets-manager main.go
I noticed it when it failed build on hub.docker.com.
I think you might be missing the build args. Can you just run make
as I showed you above?
@rvojcik did you have a chance to test it?
Hi, sorry was too busy. I didn't tried it so far. I tried just
docker build .
which use Dockerfile inside git repo to build it in docker containers.
It was the main problem for me because I didn't build docker image myself and I let the registry service to build it for me when something changed.
Ok I found the problem, I have to set env variable SECRETS_MANAGER_VERSION
.
So I have to somehow set it to the build process
Ok another update. Somehow when I tried to build it like you say, it's worked, and from there it's it worked every time even when run docker buil .
but.. when I clone clean repository and run docker build above it, it fails with that error.
This file is missing api/v1alpha1/zz_generated.deepcopy.go
when I run docker build on cleanly cloned repo
Add these 2 lines before the build in the Dockerfile and it will build straight from the dockerfile (with the build argument set for version)
RUN go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.0-beta.2
RUN /go/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths=./api/...
Docker build:
docker build --build-arg SECRETS_MANAGER_VERSION=1.0.1 .
Thanks, it works now. I have to add COPY hack/ hack/
Hi guys,
Today I tried to build v1.0.1 but I get this error. I'm not very familiar with Go so sorry for poor debug from me.