diff --git a/operator/Dockerfile b/operator/Dockerfile index 579e7ab4453a0..7047d1a8ff689 100644 --- a/operator/Dockerfile +++ b/operator/Dockerfile @@ -1,7 +1,8 @@ # We have to emulate directory layout as in the repo so that imports in go files work fine. ARG roxpath=/workspace/src/github.com/stackrox/rox +ARG GO_VERSION -FROM golang:1.17 as builder +FROM golang:${GO_VERSION} as builder # Build the manager binary ARG roxpath @@ -50,16 +51,13 @@ RUN GOOS=$(go env GOOS) scripts/go-build.sh operator # Copy the operator binary to a location from where it will be taken into the final image. RUN cp -a bin/$(go env GOOS)/operator stackrox-operator -# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/ubi8-minimal -FROM registry.access.redhat.com/ubi8-minimal:8.5 +FROM registry.access.redhat.com/ubi8-micro:8.5 ARG roxpath ARG ROX_IMAGE_FLAVOR ENV ROX_IMAGE_FLAVOR=${ROX_IMAGE_FLAVOR} -RUN microdnf update && microdnf clean all && rm -rf /var/cache/yum/* - COPY --from=builder ${roxpath}/stackrox-operator /usr/local/bin/ # The following are numeric uid and gid of `nobody` user in UBI. diff --git a/operator/Makefile b/operator/Makefile index 224ed5411c896..12edf39881b7d 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -7,6 +7,9 @@ # dropped (e.g. 3.0.61.1 -> 3.61.1) and development version ".x" is changed to ".0" (e.g. 3.0.61.x-123 -> 3.0.61.0-123). VERSION ?= $(shell $(MAKE) --quiet --no-print-directory -C .. tag | sed -E 's@^(([[:digit:]]+\.)+)x(-)?@\10\3@g' | sed -E 's@^3.0.([[:digit:]]+\.[[:digit:]]+)(-)?@3.\1\2@g') +GO_VERSION ?= $(shell cat ../EXPECTED_GO_VERSION | sed 's/go//') + + # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable") # To re-generate a bundle for other specific channels without changing the standard setup, you can: @@ -284,6 +287,7 @@ docker-build: test ## Build docker image with the operator. "$${smuggled_status_sh}" ;\ ) DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain docker build \ + --build-arg "GO_VERSION=${GO_VERSION}" \ -t ${IMG} \ --ssh default=${SSH_AUTH_SOCK} \ --build-arg ROX_IMAGE_FLAVOR=$(ROX_IMAGE_FLAVOR) \