github.com/openshift/installer@v1.4.17/images/installer/Dockerfile.upi.ci (about)

     1  # This Dockerfile is used by CI to test UPI platforms for OpenShift Installer
     2  # It builds an image containing binaries like jq, terraform, awscli, oc, etc. to allow bringing up UPI infrastructure.
     3  # It also contains the `upi` directory that contains various terraform and cloud formation templates that are used to create infrastructure resources.
     4  
     5  FROM registry.ci.openshift.org/ocp/4.17:installer-terraform-providers as providers
     6  # We copy from the -artifacts images because they are statically linked
     7  FROM registry.ci.openshift.org/ocp/4.17:installer-kube-apiserver-artifacts AS kas-artifacts
     8  FROM registry.ci.openshift.org/ocp/4.17:installer-etcd-artifacts AS etcd-artifacts
     9  
    10  FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.17 AS builder
    11  # FIPS support is offered via the baremetal-installer image
    12  ENV GO_COMPLIANCE_EXCLUDE=".*"
    13  ARG TAGS=""
    14  ARG SKIP_ENVTEST="y"
    15  WORKDIR /go/src/github.com/openshift/installer
    16  COPY . .
    17  COPY --from=providers /go/src/github.com/openshift/installer/terraform/bin/ terraform/bin/
    18  COPY --from=kas-artifacts /usr/share/openshift/ cluster-api/bin/
    19  COPY --from=etcd-artifacts /usr/share/openshift/ cluster-api/bin/
    20  RUN mkdir -p cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH) && \
    21  	mv cluster-api/bin/$(go env GOOS)/$(go env GOHOSTARCH)/* -t cluster-api/bin/$(go env GOOS)_$(go env GOHOSTARCH)/
    22  RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
    23  
    24  FROM registry.ci.openshift.org/ocp/4.17:cli as cli
    25  FROM quay.io/ocp-splat/govc:v0.30.7 as govc
    26  FROM quay.io/ocp-splat/pwsh:v7.3.12 as pwsh
    27  FROM quay.io/multi-arch/yq:3.3.0 as yq3
    28  FROM quay.io/multi-arch/yq:4.30.5 as yq4
    29  
    30  FROM registry.ci.openshift.org/ocp/4.17:base-rhel9
    31  COPY --from=cli /usr/bin/oc /bin/oc
    32  COPY --from=builder /go/src/github.com/openshift/installer/bin/openshift-install /bin/openshift-install
    33  COPY --from=builder /go/src/github.com/openshift/installer/upi /var/lib/openshift-install/upi
    34  
    35  # Install VMware plugin for powershell
    36  COPY --from=pwsh /opt/microsoft/powershell /opt/microsoft/powershell
    37  COPY --from=pwsh /root/.local/share/powershell/Modules /root/.local/share/powershell/Modules
    38  COPY --from=pwsh /usr/local/share/powershell/Modules /usr/local/share/powershell/Modules
    39  RUN ln -s /opt/microsoft/powershell/7/pwsh /bin/pwsh
    40  ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
    41  
    42  # Create settings directory /output/.local/share/VMware/PowerCLI
    43  RUN mkdir -p /output/.local/share/VMware/PowerCLI && chmod -R 777 /output/.local
    44  
    45  # Install azure-cli
    46  COPY --from=pwsh /go/src/github.com/openshift/installer/azure-cli /go/src/github.com/openshift/installer/azure-cli
    47  RUN ln -s /go/src/github.com/openshift/installer/azure-cli/bin/az /bin/az
    48  
    49  COPY --from=govc /govc /bin/govc
    50  
    51  RUN sh -c 'echo -e "[google-cloud-cli]\nname=Google Cloud CLI\nbaseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=0\ngpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" > /etc/yum.repos.d/google-cloud-sdk.repo'
    52  
    53  RUN yum update -y && \
    54      yum install --setopt=tsflags=nodocs -y \      
    55        gettext \
    56        google-cloud-cli-447.0.0-1 \
    57        gzip \
    58        jq \
    59        unzip \
    60        openssh-clients \
    61        openssl \      
    62        python3-pip \
    63        python3-pyyaml \
    64        bind-utils \
    65        util-linux \
    66        xz && \
    67      yum clean all && \
    68      rm -rf /var/cache/yum/* && \
    69      chmod g+w /etc/passwd
    70  
    71  COPY --from=yq3 /yq /bin/yq-go
    72  COPY --from=yq4 /usr/bin/yq /bin/yq-v4
    73  
    74  # Not packaged, but required by gcloud. See https://cloud.google.com/sdk/crypto
    75  # Pin version because of https://github.com/GoogleCloudPlatform/gsutil/issues/1753
    76  RUN pip-3 install cryptography pyOpenSSL==23.2.0
    77  
    78  ENV CLOUDSDK_PYTHON=/usr/bin/python
    79  ENV CLOUDSDK_PYTHON_SITEPACKAGES=1
    80  
    81  RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
    82      unzip awscliv2.zip && \
    83      ./aws/install -b /bin && \
    84      rm -rf ./aws awscliv2.zip
    85  
    86  # Download the latest IBM Cloud release binary
    87  ARG IBMCLI_URI=https://clis.cloud.ibm.com/install/linux
    88  RUN HOME=/output && \ 
    89      echo "-4" > $HOME/.curlrc && \
    90      curl -fsSL ${IBMCLI_URI} | sh && \    
    91      ibmcloud plugin install vpc-infrastructure -f && \
    92      ibmcloud plugin install cloud-dns-services -f && \
    93      ibmcloud plugin install cloud-internet-services -f && \
    94      ibmcloud plugin install key-protect -f && \
    95      ibmcloud plugin install infrastructure-service -f && \
    96      ibmcloud plugin install power-iaas -f && \
    97      ibmcloud plugin install cloud-object-storage -f && \
    98      ibmcloud plugin install dl-cli -f && \
    99      ibmcloud plugin install dns -f && \
   100      ibmcloud plugin install tg-cli -f && \
   101      cp /usr/local/bin/ibmcloud /bin/ibmcloud && \
   102      rm -f $HOME/.curlrc && \
   103      ibmcloud version && \
   104      ibmcloud plugin list
   105  
   106  
   107  RUN mkdir /output/.ssh && chown 1000:1000 "/output/.ssh/" && chmod -R g=u "/output/.ssh/"
   108  
   109  RUN chown 1000:1000 /output && chmod -R g=u "/output/.bluemix/"
   110  USER 1000:1000
   111  ENV PATH /bin
   112  ENV HOME /output
   113  WORKDIR /output