Skip to content

Commit bf52fc0

Browse files
Merge pull request #1145 from adambkaplan/ubi-go-toolset
BUILD-960: Update Containers to UBI9 go-toolset
2 parents d3544c7 + 349a4d9 commit bf52fc0

File tree

5 files changed

+20
-26
lines changed

5 files changed

+20
-26
lines changed

.ci-operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build_root_image:
22
name: release
33
namespace: openshift
4-
tag: rhel-8-release-golang-1.19-openshift-4.14
4+
tag: rhel-9-release-golang-1.20-openshift-4.15

Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
FROM openshift/origin-release:golang-1.20 AS builder
1+
FROM registry.redhat.io/ubi9/go-toolset:1.20.12 AS builder
22

33
ENV S2I_GIT_VERSION="" \
44
S2I_GIT_MAJOR="" \
55
S2I_GIT_MINOR=""
66

7-
8-
WORKDIR /tmp/source-to-image
97
COPY . .
108

11-
USER root
12-
13-
RUN make && cp _output/local/bin/linux/$(go env GOARCH)/s2i _output/local/go/bin/s2i
9+
RUN CGO_ENABLED=0 go build -a -ldflags="-s -w" -o /tmp/s2i ./cmd/s2i
1410

1511
#
1612
# Runner Image
1713
#
1814

19-
FROM registry.redhat.io/ubi8/ubi
15+
FROM registry.redhat.io/ubi9/ubi-minimal:9.4
2016

21-
COPY --from=builder /tmp/source-to-image/_output/local/go/bin/s2i /usr/local/bin/s2i
17+
COPY --from=builder /tmp/s2i /usr/local/bin/s2i
2218

2319
USER 1001
2420

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ OUT_DIR = _output
1212

1313
export GOFLAGS
1414

15+
VERSION = latest
16+
CONTAINER_ENGINE = podman
17+
1518
# Build code.
1619
#
1720
# Args:
@@ -24,6 +27,9 @@ all build:
2427
hack/build-go.sh
2528
.PHONY: all build
2629

30+
build-container:
31+
${CONTAINER_ENGINE} build -t localhost/source-to-image/s2i:${VERSION} .
32+
2733
# Verify if code is properly organized.
2834
#
2935
# Example:
@@ -97,6 +103,6 @@ clean:
97103
# Example:
98104
# make release
99105
release: clean
100-
hack/build-release.sh
106+
S2I_BUILD_CMD="${CONTAINER_ENGINE}" hack/build-release.sh
101107
hack/extract-release.sh
102108
.PHONY: release

hack/build-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ echo "++ Building release ${S2I_GIT_VERSION}"
3737
# Perform the build and release in podman or docker.
3838
if [[ "$(go env GOHOSTOS)" == "darwin" ]]; then
3939
$buildCmd run --rm -it -e RELEASE_LDFLAGS="-w -s" \
40-
-v "${S2I_ROOT}":/go/src/github.com/openshift/source-to-image \
40+
-v "${S2I_ROOT}":/opt/app-root/src/source-to-image \
4141
openshift/sti-release
4242
else
4343
$buildCmd run --rm -it -e RELEASE_LDFLAGS="-w -s" \
44-
-v "${S2I_ROOT}":/go/src/github.com/openshift/source-to-image:z \
44+
-v "${S2I_ROOT}":/opt/app-root/src/source-to-image:z \
4545
openshift/sti-release
4646
fi
4747

images/release/Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@
33
#
44
# The standard name for this image is openshift/sti-release
55
#
6-
FROM registry.redhat.io/ubi8/ubi
6+
FROM registry.redhat.io/ubi9/go-toolset:1.20.12 AS builder
77

8-
ENV VERSION=1.20 \
9-
GOARM=5 \
10-
GOPATH=/go \
11-
GOROOT=/usr/local/go \
12-
S2I_VERSION_FILE=/go/src/github.com/openshift/source-to-image/sti-version-defs
13-
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
8+
USER root
9+
ENV S2I_VERSION_FILE=/opt/app-root/src/source-to-image/sti-version-defs
1410

15-
RUN yum install -y git gcc zip && \
16-
yum clean all && \
17-
curl https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz | tar -C /usr/local -xzf - && \
18-
touch /sti-build-image && \
19-
mkdir -p /go/src/github.com/openshift/source-to-image
11+
RUN mkdir -p /opt/app-root/src/source-to-image
2012

21-
WORKDIR /go/src/github.com/openshift/source-to-image
22-
VOLUME ["/go/src/github.com/openshift/source-to-image"]
13+
WORKDIR /opt/app-root/src/source-to-image
14+
VOLUME ["/opt/app-root/src/source-to-image"]
2315
# Expect source to be mounted in
2416
CMD ["./hack/build-cross.sh"]

0 commit comments

Comments
 (0)