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

     1  # Copyright 2019 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/ubi7/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 6341AB2753D78A78A7C27BB124C6A8A7F4A80EB5 A4A9406876FCBD3C456770C88C718D3B5072E1F5 ) \
    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 6341AB2753D78A78A7C27BB124C6A8A7F4A80EB5 > ${GNUPGHOME}/RPM-GPG-KEY-CentOS-7 \
    45   && gpg --export --armor A4A9406876FCBD3C456770C88C718D3B5072E1F5 > ${GNUPGHOME}/RPM-GPG-KEY-MySQL \
    46   && rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona.1 ${GNUPGHOME}/RPM-GPG-KEY-Percona.2 ${GNUPGHOME}/RPM-GPG-KEY-CentOS-7 ${GNUPGHOME}/RPM-GPG-KEY-MySQL /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release \
    47   && curl -L --retry-delay 10 --retry 3 -o /tmp/mysqlrepo.rpm https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm \
    48   && curl -L --retry-delay 10 --retry 3 -o /tmp/perconarepo.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm \
    49   && rpmkeys --checksig /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm \
    50   && rpm -Uvh /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm \
    51   && rm -f /tmp/mysqlrepo.rpm /tmp/perconarepo.rpm
    52  RUN echo H4sICH852V8CA2ZvbwC1jr0OgkAQhPt7CgrbY7W6xOQaDaEgRqKxMMTiOFYg/F2WI9G39xCttKGg2UxmJrNfokWqeryxVjUo99ja45kLj3s757IxGqiWhbVmC9CURB352rW63u8oh0mCAHdWY1uRLoDlJtcF6kpuRlnhU97LGt0CoNVgqhLINNxFcIoPPIxDHgVX/v3OsFVpjZlcM5ZoMZhMWex/ES9TMIPyM7UYKj4sqT+kwdufAToNLcP5AvRgmV7zAQAA | base64 -d | gzip -dc > /etc/yum.repos.d/CentOS-Base.repo \
    53   && yum install -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs --enablerepo c7base --enablerepo c7updates --enablerepo c7extras install libev gperftools-libs numactl-libs sysstat strace
    54  RUN yum update -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs \
    55   && yum install -y --setopt=alwaysprompt=no --setopt=tsflags=nodocs bzip2 ca-certificates gnupg libaio libcurl \
    56      jemalloc gperftools-libs procps-ng rsync wget openssl hostname curl tzdata make \
    57  # Can't use alwaysprompt=no here, since we need to pick up deps
    58  #   No way to separate key imports and accept deps separately in yum/dnf
    59   && yum install -y --setopt=tsflags=nodocs --enablerepo mysql80-community --disablerepo mysql57-community \
    60      mysql-community-client mysql-community-server \
    61  # Have to use hacks to ignore conflicts on /etc/my.cnf install
    62   && mkdir -p /tmp/1 \
    63   && yum install -y --setopt=alwaysprompt=no --downloadonly --downloaddir=/tmp/1 --enablerepo mysql80-community --disablerepo mysql57-community percona-xtrabackup-80 percona-toolkit \
    64   && rpm -Uvh --replacefiles /tmp/1/*rpm \
    65   && rm -rf /tmp/1 \
    66   && yum clean all \
    67   && yum clean all --enablerepo mysql80-community --disablerepo mysql57-community \
    68   && rm -rf /etc/my.cnf /var/lib/mysql /tmp/gpg /sbin/mysqld-debug
    69  
    70  # Set up Vitess user and directory tree.
    71  RUN groupadd -g 1001 -r vitess && useradd -r -u 1001 -g vitess vitess
    72  RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt
    73  
    74  # Set up Vitess environment (just enough to run pre-built Go binaries)
    75  ENV VTROOT /vt/src/vitess.io/vitess
    76  ENV VTDATAROOT /vt/vtdataroot
    77  ENV PATH $VTROOT/bin:$PATH
    78  ENV MYSQL_FLAVOR MySQL80
    79  
    80  # Copy artifacts from builder layer.
    81  COPY --from=builder --chown=vitess:vitess /vt/install /vt
    82  COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin
    83  
    84  RUN mkdir -p /licenses
    85  COPY LICENSE /licenses
    86  
    87  # Create mount point for actual data (e.g. MySQL data dir)
    88  VOLUME /vt/vtdataroot
    89  USER vitess
    90  
    91  LABEL name="Vitess Lite image - MySQL Community Server 8.0" \
    92        io.k8s.display-name="Vitess Lite image - MySQL Community Server 8.0" \
    93        maintainer="cncf-vitess-maintainers@lists.cncf.io" \
    94        vendor="CNCF" \
    95        version="6.0.0" \
    96        release="1" \
    97        summary="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
    98        description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
    99        io.k8s.description="Vitess base container image, containing Vitess components along with MySQL Community Server 8.0" \
   100        distribution-scope="public" \
   101        url="https://vitess.io"