15
15
###############################################################################
16
16
# Create the develop, test, and build environment
17
17
###############################################################################
18
+ ARG GOLANG_VERSION=1.22
19
+ FROM registry.access.redhat.com/ubi9/go-toolset:$GOLANG_VERSION
18
20
19
- # TODO: replace the "go_toolset" build stage once ubi8/go-toolset:1.21 is available
20
- # the go-toolset 1.21 is based on ubi9, we need to update it in the base image as well.
21
- FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as go-toolset
22
-
23
- # https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
24
- # We need TARGETOS and TARGETARCH (not BUILDOS and BUILDARCH) since the developer
25
- # image should be built for the OS of the developer using it (this is not a "builder image")
26
- ARG TARGETOS
27
- ARG TARGETARCH
28
-
29
- ARG GOLANG_VERSION=1.21.6
30
-
31
- USER root
32
-
33
- ENV HOME=/root \
34
- PATH=/usr/local/go/bin:$PATH:
35
-
36
- WORKDIR /workspace
37
-
38
- # install necessary tools that are included in the ubi/go-toolset image that we are temporarily replacing
39
- RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
40
- microdnf --setopt=cachedir=/root/.cache/microdnf --nodocs install \
41
- diffutils \
42
- gcc-c++ \
43
- make \
44
- wget \
45
- tar \
46
- git \
47
- which \
48
- && microdnf update --nodocs \
49
- && true
50
-
51
- # install go
52
- RUN true \
53
- && wget -qO go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" \
54
- && tar -C /usr/local -xzf go.tgz \
55
- && go version \
56
- && rm go.tgz \
57
- && true
58
-
59
- ####################################################################################
60
- # TODO: replace "go-toolset" build stage with ubi/go-toolset:1.21 once available #
61
- # and swap `microdnf` commands for `dnf` #
62
- ####################################################################################
63
- FROM go-toolset
64
21
65
22
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
66
23
# don't provide "default" values (e.g. 'ARG TARGETARCH=amd64') for non-buildx environments,
@@ -81,14 +38,15 @@ ENV HOME=/go
81
38
WORKDIR /go/src/github.com/opendatahub-io/modelmesh-serving/
82
39
83
40
# Install build and dev tools
84
- # NOTE: Require python38 to install pre-commit
41
+ # NOTE: Require python3 to install pre-commit
85
42
RUN --mount=type=cache,target=/root/.cache/dnf:rw \
86
43
dnf install --setopt=cachedir=/root/.cache/dnf -y --nodocs \
87
44
nodejs \
88
45
jq \
89
- python38 \
90
- && ln -sf /usr/bin/python3 /usr/bin/python \
91
- && ln -sf /usr/bin/pip3 /usr/bin/pip \
46
+ python3.11 \
47
+ python3.11-pip \
48
+ && alternatives --install /usr/bin/unversioned-python python /usr/bin/python3.11 1 \
49
+ && alternatives --install /usr/bin/pip pip /usr/bin/pip3.11 1 \
92
50
&& true
93
51
94
52
# Install pre-commit
@@ -161,7 +119,7 @@ RUN true \
161
119
# Use setup-envtest for kubebuilder to use K8s version 1.23+ for autoscaling/v2 (HPA)
162
120
RUN true \
163
121
&& go install sigs.k8s.io/controller-runtime/tools/
[email protected] \
164
- && setup-envtest use 1.23 \
122
+ && setup-envtest use 1.26 \
165
123
&& true
166
124
167
125
# For GitHub Action 'lint', work around error "detected dubious ownership in repository at '/workspace'"
0 commit comments