1515###############################################################################
1616# Create the develop, test, and build environment
1717###############################################################################
18+ ARG GOLANG_VERSION=1.22
19+ FROM registry.access.redhat.com/ubi9/go-toolset:$GOLANG_VERSION
1820
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
6421
6522# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
6623# don't provide "default" values (e.g. 'ARG TARGETARCH=amd64') for non-buildx environments,
@@ -81,14 +38,15 @@ ENV HOME=/go
8138WORKDIR /go/src/github.com/opendatahub-io/modelmesh-serving/
8239
8340# Install build and dev tools
84- # NOTE: Require python38 to install pre-commit
41+ # NOTE: Require python3 to install pre-commit
8542RUN --mount=type=cache,target=/root/.cache/dnf:rw \
8643 dnf install --setopt=cachedir=/root/.cache/dnf -y --nodocs \
8744 nodejs \
8845 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 \
9250 && true
9351
9452# Install pre-commit
@@ -161,7 +119,7 @@ RUN true \
161119# Use setup-envtest for kubebuilder to use K8s version 1.23+ for autoscaling/v2 (HPA)
162120RUN true \
163121 && go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240320141353-395cfc7486e6 \
164- && setup-envtest use 1.23 \
122+ && setup-envtest use 1.26 \
165123 && true
166124
167125# For GitHub Action 'lint', work around error "detected dubious ownership in repository at '/workspace'"
0 commit comments