Skip to content

Commit 1753188

Browse files
authored
Added controller-gen installation in the golang image (#117)
* Added controller-gen installation in the golang image Signed-off-by: Nacho Fuertes <[email protected]> * Specify version for controller-gen dependency and make it configurable by build arg to avoid issues with 1.20 and 1.21 versions of golang Signed-off-by: Nacho Fuertes <[email protected]> --------- Signed-off-by: Nacho Fuertes <[email protected]>
1 parent a310006 commit 1753188

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docker-compose.golang.yml

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ services:
3232
dockerfile: golang/Dockerfile
3333
args:
3434
VERSION: "1.21"
35+
# Need to override this because default value doesn't work with this golang version
36+
CONTROLLER_GEN_VERSION: "v0.14.0"
3537

3638
golang1.20:
3739
image: okteto/golang:1.20
@@ -41,3 +43,5 @@ services:
4143
args:
4244
VERSION: "1.20"
4345
DEBIAN_VERSION: "buster"
46+
# Need to override this because default value doesn't work with this golang version
47+
CONTROLLER_GEN_VERSION: "v0.14.0"

golang/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ ARG VERSION="1.23"
22
ARG DEBIAN_VERSION="bookworm"
33
FROM golang:${VERSION}-${DEBIAN_VERSION}
44

5+
ARG CONTROLLER_GEN_VERSION="v0.16.5"
6+
57
WORKDIR /usr/src/app
68

79
# setup okteto message
810
COPY bashrc /root/.bashrc
911

1012
RUN go install github.com/codegangsta/gin@latest && \
1113
go install github.com/go-delve/delve/cmd/dlv@latest && \
12-
go install golang.org/x/tools/gopls@latest
14+
go install golang.org/x/tools/gopls@latest && \
15+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
1316
RUN curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s -- -b /usr/bin
1417

1518
CMD ["bash"]

0 commit comments

Comments
 (0)