Skip to content

Commit 53083af

Browse files
mdboothmandre
authored andcommitted
CARRY: Add OCP CI config
1 parent 2a73c18 commit 53083af

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.ci-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build_root_image:
2+
name: release
3+
namespace: openshift
4+
tag: rhel-8-release-golang-1.21-openshift-4.16

Dockerfile.rhel

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2019 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Build the manager binary
16+
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.21-openshift-4.16 AS builder
17+
WORKDIR /workspace
18+
19+
# Run this with docker build --build_arg goproxy=$(go env GOPROXY) to override the goproxy
20+
ARG goproxy=https://proxy.golang.org
21+
ENV GOPROXY=$goproxy
22+
23+
# Copy the sources
24+
COPY ./ ./
25+
26+
# Build
27+
ARG package=.
28+
ARG ARCH
29+
ARG ldflags
30+
31+
# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
32+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
33+
go build -ldflags "${ldflags} -extldflags '-static'" \
34+
-o manager ${package}
35+
36+
# Production image
37+
FROM registry.ci.openshift.org/ocp/4.16:base
38+
WORKDIR /
39+
COPY --from=builder /workspace/manager .
40+
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
41+
USER 65532
42+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)