github.com/verrazzano/verrazzano@v1.7.0/platform-operator/Dockerfile (about)

     1  # Copyright (c) 2020, 2023, Oracle and/or its affiliates.
     2  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  ARG ISTIO_ISTIOCTL_IMAGE
     5  
     6  ARG BASE_IMAGE=ghcr.io/oracle/oraclelinux:8-slim
     7  FROM $BASE_IMAGE AS build_base
     8  
     9  # Need to use specific WORKDIR to match verrazzano's source packages
    10  WORKDIR /root/go/src/github.com/verrazzano/verrazzano/platform-operator
    11  COPY . .
    12  
    13  COPY out/linux_amd64/verrazzano-platform-operator /usr/local/bin/verrazzano-platform-operator
    14  
    15  RUN chmod 500 /usr/local/bin/verrazzano-platform-operator \
    16      && chmod +x scripts/install/*.sh \
    17      && chmod +x scripts/*.sh
    18  
    19  # istioctl image to copy the istioctl binary to the final image
    20  FROM $ISTIO_ISTIOCTL_IMAGE AS istio_istioctl
    21  
    22  # Create the verrazzano-platform-operator image
    23  FROM $BASE_IMAGE AS final
    24  
    25  ARG VERRAZZANO_PLATFORM_OPERATOR_IMAGE
    26  
    27  # copy olcne repos needed to install kubectl
    28  COPY --from=build_base /root/go/src/github.com/verrazzano/verrazzano/platform-operator/repos/*.repo /etc/yum.repos.d/
    29  
    30  COPY --from=istio_istioctl /usr/local/bin/istioctl /usr/local/bin/istioctl
    31  
    32  RUN microdnf install -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs openssl jq kubectl-1.26.6-1.el8 \
    33      && microdnf clean all \
    34      && rm -rf /var/cache/yum /var/lib/rpm/* \
    35      && groupadd -r verrazzano \
    36      && useradd --no-log-init -r -m -d /verrazzano -g verrazzano -u 1000 verrazzano \
    37      && mkdir /home/verrazzano \
    38      && chown -R 1000:verrazzano /home/verrazzano \
    39      && curl --proto "=https" -L https://github.com/verrazzano/cluster-api/releases/download/v1.5.0/clusterctl-linux-amd64 -o /usr/local/bin/clusterctl \
    40      && chmod +x /usr/local/bin/clusterctl
    41  
    42  # Copy the operator binary
    43  COPY --from=build_base --chown=verrazzano:verrazzano /usr/local/bin/verrazzano-platform-operator /usr/local/bin/verrazzano-platform-operator
    44  
    45  # Copy the Verrazzano install and uninstall scripts
    46  WORKDIR /verrazzano
    47  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/thirdparty ./platform-operator/thirdparty
    48  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/manifests ./platform-operator/manifests
    49  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/scripts/wait4webhook.sh ./platform-operator/scripts/wait4webhook.sh
    50  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/scripts/hooks ./platform-operator/scripts/hooks
    51  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/scripts/install ./platform-operator/scripts/install
    52  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/config/scripts/run.sh .
    53  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/config/scripts/kubeconfig-template ./config/kubeconfig-template
    54  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/helm_config ./platform-operator/helm_config
    55  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/out/generated-verrazzano-bom.json ./platform-operator/verrazzano-bom.json
    56  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/capi/bootstrap-ocne ./capi/bootstrap-ocne
    57  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/capi/control-plane-ocne ./capi/control-plane-ocne
    58  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/capi/infrastructure-oci ./capi/infrastructure-oci
    59  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/capi/cluster-api ./capi/cluster-api
    60  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/capi/addon-verrazzano ./capi/addon-verrazzano
    61  COPY --from=build_base --chown=verrazzano:verrazzano /root/go/src/github.com/verrazzano/verrazzano/platform-operator/out/generated-catalog.yaml ./platform-operator/manifests/catalog/catalog.yaml
    62  
    63  COPY --from=build_base /root/go/src/github.com/verrazzano/verrazzano/platform-operator/THIRD_PARTY_LICENSES.txt /licenses/
    64  
    65  # set the default VPO image in values.yaml for the VPO helm chart
    66  RUN  sed -i -e "s|image:|image: $VERRAZZANO_PLATFORM_OPERATOR_IMAGE|g" ./platform-operator/helm_config/charts/verrazzano-platform-operator/values.yaml
    67  
    68  USER 1000
    69  
    70  ENTRYPOINT ["/verrazzano/run.sh"]