forked from project-codeflare/codeflare-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (33 loc) · 978 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Build the manager binary
# BEGIN -- workaround lack of go-toolset for golang 1.22
ARG GOLANG_IMAGE=docker.io/library/golang:1.22
ARG GOARCH=amd64
FROM ${GOLANG_IMAGE} AS golang
FROM registry.access.redhat.com/ubi8/ubi:8.8 AS builder
# Install system dependencies
RUN dnf upgrade -y && dnf install -y \
gcc \
make \
openssl-devel \
&& dnf clean all && rm -rf /var/cache/yum
# Install Go
ENV PATH=/usr/local/go/bin:$PATH
COPY --from=golang /usr/local/go /usr/local/go
# END -- workaround lack of go-toolset for golang 1.22
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY ./Makefile ./Makefile
RUN go mod download
# Copy the Go sources
COPY main.go main.go
COPY pkg/ pkg/
# Build
USER root
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} make go-build-for-image
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["/manager"]