vitess.io/vitess@v0.16.2/docker/lite/Dockerfile.ubi8.mysql80 (about)

     1  # Copyright 2022 The Vitess 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  # NOTE: We have to build the Vitess binaries from scratch instead of sharing
    16  #       a base image because Docker Hub dropped the feature we relied upon to
    17  #       ensure images contain the right binaries.
    18  
    19  # Use a temporary layer for the build stage.
    20  ARG bootstrap_version=14.3
    21  ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"
    22  
    23  FROM "${image}" AS builder
    24  
    25  # Allows docker builds to set the BUILD_NUMBER
    26  ARG BUILD_NUMBER
    27  
    28  # Re-copy sources from working tree.
    29  COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess
    30  
    31  # Build and install Vitess in a temporary output directory.
    32  USER vitess
    33  RUN make install PREFIX=/vt/install
    34  
    35  # Start over and build the final image.
    36  FROM registry.access.redhat.com/ubi8/ubi:latest
    37  
    38  # Install keys and dependencies
    39  RUN mkdir /tmp/gpg && chmod 700 /tmp/gpg && export GNUPGHOME=/tmp/gpg \
    40   && yum install -y --setopt=alwaysprompt=no gnupg \
    41   && ( gpg --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 4D1BB29D63D98E422B2113B19334A25F8507EFA5 99DB70FAE1D7CE227FB6488205B555B38483C65D 3A79BD29 A4A9406876FCBD3C456770C88C718D3B5072E1F5 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 ) \
    42   && gpg --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona.1 \
    43   && gpg --export --armor 4D1BB29D63D98E422B2113B19334A25F8507EFA5 > ${GNUPGHOME}/RPM-GPG-KEY-Percona.2 \
    44   && gpg --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-CentOS-8 \
    45   && gpg --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8 \
    46   && gpg --export --armor 3A79BD29 > ${GNUPGHOME}/RPM-GPG-KEY-MySQL.1 \
    47   && gpg --export --armor A4A9406876FCBD3C456770C88C718D3B5072E1F5 > ${GNUPGHOME}/RPM-GPG-KEY-MySQL.2 \
    48   && rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona.1 ${GNUPGHOME}/RPM-GPG-KEY-Percona.2 ${GNUPGHOME}/RPM-GPG-KEY-CentOS-8 ${GNUPGHOME}/RPM-GPG-KEY-MySQL.1 ${GNUPGHOME}/RPM-GPG-KEY-MySQL.2 /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8 \
    49   && curl -L --retry-delay 10 --retry 3 -o /tmp/mysqlrepo.rpm https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm \
    50   && curl -L --retry-delay 10 --retry 3 -o /tmp/perconarepo.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm \
    51   && rpmkeys --checksig /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm \
    52   && rpm -Uvh /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm \
    53   && rm -f /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm
    54  RUN echo H4sICIDAHmICA2ZvbwDVkDFLxEAQhfv9FVfY7o4RhCBsoXJcIXKHwUIOi7m5MVk2yS6zG0//vYlRULTU4rrHvOHN+2ZL5Q4TP6oeO7bX3Od1pcuFXlyNUzVZg7S2yTmmCwDsgzjuDSUyB5SDI2+QzOChcyJBEnwkPOPQZijNuTkrigKmsHUFJ1MeCjUQEqg61tQweVtM0vOrfXItj1eAM0H0DiR2erTgbnOrV5uVvlk+6M+Kinvctby3p0ptqRziHjOnnxz3s/FnKJcxVlkYu/+k4Zcs+AvM8n3+jWW8MBc2NO6FZILUMEsoYQ76UvWI/vAGB/SOZZsCAAA= | base64 -d | gzip -dc > /etc/yum.repos.d/CentOS-Base.repo \
    55   && yum install -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs --enablerepo c8base --enablerepo c8updates --enablerepo c8extras libev numactl-libs sysstat strace \
    56   && yum install -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/g/gperftools-libs-2.7-9.el8.x86_64.rpm https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/j/jemalloc-5.2.1-2.el8.x86_64.rpm https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/l/libunwind-1.3.1-3.el8.x86_64.rpm
    57  RUN yum update -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs \
    58   && yum install -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs bzip2 ca-certificates gnupg libaio libcurl \
    59      procps-ng rsync wget openssl hostname curl tzdata make \
    60  # Can't use alwaysprompt=no here, since we need to pick up deps
    61  #   No way to separate key imports and accept deps separately in yum/dnf
    62   && yum install -y --setopt=tsflags=nodocs --enablerepo mysql80-community \
    63      mysql-community-client mysql-community-server \
    64  # Have to use hacks to ignore conflicts on /etc/my.cnf install
    65   && mkdir -p /tmp/1 \
    66   && /usr/bin/percona-release enable-only pxb-80 \
    67   && /usr/bin/percona-release enable pt \
    68   && yum install -y --setopt=alwaysprompt=no --downloadonly --downloaddir=/tmp/1 --enablerepo mysql80-community percona-xtrabackup-80 percona-toolkit \
    69   && rpm -Uvh --replacefiles /tmp/1/*rpm \
    70   && rm -rf /tmp/1 \
    71   && yum clean all \
    72   && yum clean all --enablerepo mysql80-community \
    73   && rm -rf /etc/my.cnf /var/lib/mysql /tmp/gpg /sbin/mysqld-debug
    74  
    75  # Set up Vitess user and directory tree.
    76  RUN groupadd -g 1001 -r vitess && useradd -r -u 1001 -g vitess vitess
    77  RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
    78  
    79  # Set up Vitess environment (just enough to run pre-built Go binaries)
    80  ENV VTROOT /vt/src/vitess.io/vitess
    81  ENV VTDATAROOT /vt/vtdataroot
    82  ENV PATH $VTROOT/bin:$PATH
    83  ENV MYSQL_FLAVOR MySQL80
    84  
    85  # Copy artifacts from builder layer.
    86  COPY --from=builder --chown=vitess:vitess /vt/install /vt
    87  COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin
    88  
    89  RUN mkdir -p /licenses
    90  COPY LICENSE /licenses
    91  
    92  # Create mount point for actual data (e.g. MySQL data dir)
    93  VOLUME /vt/vtdataroot
    94  USER vitess
    95  
    96  LABEL name="Vitess Lite image - MySQL Community Server 8.0" \
    97        io.k8s.display-name="Vitess Lite image - MySQL Community Server 8.0" \
    98        maintainer="cncf-vitess-maintainers@lists.cncf.io" \
    99        vendor="CNCF" \
   100        version="13.0.0" \
   101        release="1" \
   102        summary="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
   103        description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
   104        io.k8s.description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
   105        distribution-scope="public" \
   106        url="https://vitess.io"