From 84ba13e009ea6c510c46fe34d3a7df73d598c934 Mon Sep 17 00:00:00 2001 From: Spolti Date: Mon, 20 May 2024 14:42:33 -0300 Subject: [PATCH 1/2] Use latest tag to grab updates upon new build Signed-off-by: Spolti --- Dockerfile | 2 +- Dockerfile.develop | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad17109a..c6736e65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ ############################################################################### # Stage 2: Copy build assets to create the smallest final runtime image ############################################################################### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 AS runtime +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS runtime ARG USER=2000 ARG IMAGE_VERSION diff --git a/Dockerfile.develop b/Dockerfile.develop index 5106da39..aeafe474 100644 --- a/Dockerfile.develop +++ b/Dockerfile.develop @@ -23,7 +23,8 @@ ############################################################################### # TODO: replace the "go_toolset" build stage once ubi8/go-toolset:1.21 is available -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 as go-toolset +# the go-toolset 1.21 is based on ubi9, we need to update it in the base image as well. +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as go-toolset # https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope # We need TARGETOS and TARGETARCH (not BUILDOS and BUILDARCH) since the developer From 094611103097bff59d337c7b0825b1c1f02a6f17 Mon Sep 17 00:00:00 2001 From: Spolti Date: Mon, 20 May 2024 14:49:07 -0300 Subject: [PATCH 2/2] align go lang version in the Dockerfile.develop.ci Signed-off-by: Spolti --- Dockerfile.develop.ci | 47 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Dockerfile.develop.ci b/Dockerfile.develop.ci index 915de2b3..792c65ce 100644 --- a/Dockerfile.develop.ci +++ b/Dockerfile.develop.ci @@ -15,7 +15,52 @@ ############################################################################### # Create the develop, test, and build environment ############################################################################### -FROM registry.access.redhat.com/ubi8/go-toolset:1.19 + +# TODO: replace the "go_toolset" build stage once ubi8/go-toolset:1.21 is available +# the go-toolset 1.21 is based on ubi9, we need to update it in the base image as well. +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as go-toolset + +# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +# We need TARGETOS and TARGETARCH (not BUILDOS and BUILDARCH) since the developer +# image should be built for the OS of the developer using it (this is not a "builder image") +ARG TARGETOS +ARG TARGETARCH + +ARG GOLANG_VERSION=1.21.6 + +USER root + +ENV HOME=/root \ + PATH=/usr/local/go/bin:$PATH: + +WORKDIR /workspace + +# install necessary tools that are included in the ubi/go-toolset image that we are temporarily replacing +RUN --mount=type=cache,target=/root/.cache/microdnf:rw \ + microdnf --setopt=cachedir=/root/.cache/microdnf --nodocs install \ + diffutils \ + gcc-c++ \ + make \ + wget \ + tar \ + git \ + which \ + && microdnf update --nodocs \ + && true + +# install go +RUN true \ + && wget -qO go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.${TARGETOS:-linux}-${TARGETARCH:-amd64}.tar.gz" \ + && tar -C /usr/local -xzf go.tgz \ + && go version \ + && rm go.tgz \ + && true + +#################################################################################### +# TODO: replace "go-toolset" build stage with ubi/go-toolset:1.21 once available # +# and swap `microdnf` commands for `dnf` # +#################################################################################### +FROM go-toolset # https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope # don't provide "default" values (e.g. 'ARG TARGETARCH=amd64') for non-buildx environments,