-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathDockerfile.assisted-installer-controller
35 lines (26 loc) · 1.3 KB
/
Dockerfile.assisted-installer-controller
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
FROM registry.access.redhat.com/ubi9/go-toolset:1.21 AS builder
ARG TARGETPLATFORM
ENV GOFLAGS=-mod=mod
WORKDIR /go/src/github.com/openshift/assisted-installer
# Workaround for creating build folder
USER root
# Bring in the go dependencies before anything else so we can take
# advantage of caching these layers in future builds.
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY . .
RUN git config --global --add safe.directory '*'; \
TARGETPLATFORM=$TARGETPLATFORM make controller
# Extract the commit reference from which the image is built
RUN git rev-parse --short HEAD > /commit-reference.txt
FROM quay.io/centos/centos:stream9
ARG TARGETPLATFORM
# openshift clients
RUN case $TARGETPLATFORM in "") platform=amd64;; *) platform=`echo $TARGETPLATFORM | sed 's#linux/##'` ;; esac ; \
curl -k -L -s "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/latest/amd64/openshift-client-linux-${platform}-rhel9.tar.gz" | tar xvz -C /usr/bin; \
chmod +x /usr/bin/oc /usr/bin/kubectl
COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/assisted-installer-controller /usr/bin/assisted-installer-controller
# Copy the commit reference from the builder
COPY --from=builder /commit-reference.txt /commit-reference.txt
ENTRYPOINT ["/usr/bin/assisted-installer-controller"]