|
| 1 | +FROM golang:1.19 AS go_builder |
| 2 | + |
| 3 | +RUN git clone --branch=main https://github.com/percona/percona-xtradb-cluster-operator.git /go/src/github.com/percona/percona-xtradb-cluster-operator/ |
| 4 | +WORKDIR /go/src/github.com/percona/percona-xtradb-cluster-operator/cmd/peer-list |
| 5 | +RUN go build |
| 6 | + |
| 7 | +FROM redhat/ubi8-minimal |
| 8 | + |
| 9 | +LABEL org.opencontainers.image.authors="info@percona.com" |
| 10 | + |
| 11 | +ENV PXB_VERSION 2.4.29-1 |
| 12 | +ENV PXC_VERSION 5.7.44-31.65.2 |
| 13 | +ENV PXC_REPO release |
| 14 | +ENV OS_VER el8 |
| 15 | +ENV FULL_PERCONA_XTRABACKUP_VERSION "$PXB_VERSION.$OS_VER" |
| 16 | +ENV FULL_PERCONA_XTRADBCLUSTER_VERSION "$PXC_VERSION.$OS_VER" |
| 17 | +ENV PXC_TELEMETRY_VERSION 5.7.44-31.65-2 |
| 18 | + |
| 19 | +# Do not report during Docker image creation. |
| 20 | +# Note that doing so, would create telemetry config file |
| 21 | +# which would prevent reporting when new container is started. |
| 22 | +# If we want to track Docker image creation as well, |
| 23 | +# remove telemetry config file after installing packages! |
| 24 | +ARG PERCONA_TELEMETRY_DISABLE=1 |
| 25 | + |
| 26 | +COPY Percona-XtraDB-Cluster-server-57-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 27 | +COPY Percona-XtraDB-Cluster-client-57-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 28 | +COPY Percona-XtraDB-Cluster-shared-57-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 29 | +COPY Percona-XtraDB-Cluster-devel-57-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 30 | +COPY Percona-XtraDB-Cluster-57-debuginfo-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 31 | +COPY Percona-XtraDB-Cluster-server-57-debuginfo-${PXC_VERSION}.el8.x86_64.rpm /tmp |
| 32 | + |
| 33 | +# check repository package signature in secure way |
| 34 | +RUN set -ex; \ |
| 35 | + export GNUPGHOME="$(mktemp -d)"; \ |
| 36 | + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 76FD3DB13AB67410B89DB10E82562EA9AD986DA3; \ |
| 37 | + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ |
| 38 | + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ |
| 39 | + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ |
| 40 | + gpg --batch --export --armor 76FD3DB13AB67410B89DB10E82562EA9AD986DA3 > ${GNUPGHOME}/RPM-GPG-KEY-oracle; \ |
| 41 | + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8 ${GNUPGHOME}/RPM-GPG-KEY-oracle; \ |
| 42 | + microdnf install -y findutils; \ |
| 43 | + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ |
| 44 | + rpmkeys --checksig /tmp/percona-release.rpm; \ |
| 45 | + rpm -i /tmp/percona-release.rpm; \ |
| 46 | + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ |
| 47 | + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ |
| 48 | + percona-release enable-only tools release; \ |
| 49 | + percona-release enable pxc-57 ${PXC_REPO} |
| 50 | + |
| 51 | +RUN set -ex; \ |
| 52 | + curl -Lf -o /tmp/numactl-libs.rpm http://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/numactl-libs-2.0.12-13.el8.x86_64.rpm; \ |
| 53 | + curl -Lf -o /tmp/libev.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/libev-4.24-6.el8.x86_64.rpm; \ |
| 54 | + curl -Lf -o /tmp/jq.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/jq-1.5-12.el8.x86_64.rpm; \ |
| 55 | + curl -Lf -o /tmp/oniguruma.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/oniguruma-6.8.2-2.el8.x86_64.rpm; \ |
| 56 | + curl -Lf -o /tmp/pv.rpm http://download.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/p/pv-1.6.6-7.el8.x86_64.rpm; \ |
| 57 | + curl -Lf -o /tmp/socat.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/socat-1.7.4.1-1.el8.x86_64.rpm; \ |
| 58 | + rpmkeys --checksig /tmp/socat.rpm /tmp/numactl-libs.rpm /tmp/libev.rpm /tmp/jq.rpm /tmp/oniguruma.rpm /tmp/pv.rpm; \ |
| 59 | + rpm -i /tmp/socat.rpm /tmp/numactl-libs.rpm /tmp/libev.rpm /tmp/jq.rpm /tmp/oniguruma.rpm /tmp/pv.rpm; \ |
| 60 | + rm -rf /tmp/socat.rpm /tmp/numactl-libs.rpm /tmp/libev.rpm /tmp/jq.rpm /tmp/oniguruma.rpm /tmp/pv.rpm |
| 61 | + |
| 62 | +RUN set -ex; \ |
| 63 | + rpm -e --nodeps tzdata; \ |
| 64 | + microdnf --setopt=install_weak_deps=0 --best install -y \ |
| 65 | + jemalloc \ |
| 66 | + openssl \ |
| 67 | + shadow-utils \ |
| 68 | + hostname \ |
| 69 | + curl \ |
| 70 | + tzdata \ |
| 71 | + diffutils \ |
| 72 | + libaio \ |
| 73 | + which \ |
| 74 | + pam \ |
| 75 | + procps-ng \ |
| 76 | + qpress \ |
| 77 | + krb5-libs \ |
| 78 | + cracklib-dicts \ |
| 79 | + libatomic \ |
| 80 | + tar; \ |
| 81 | + microdnf update \ |
| 82 | + curl \ |
| 83 | + glibc \ |
| 84 | + libnghttp2 \ |
| 85 | + python3; \ |
| 86 | + microdnf clean all; \ |
| 87 | + rm -rf /var/cache/dnf /var/cache/yum |
| 88 | + |
| 89 | +# create mysql user/group before mysql installation |
| 90 | +RUN groupadd -g 1001 mysql; \ |
| 91 | + useradd -u 1001 -r -g 1001 -s /sbin/nologin \ |
| 92 | + -c "Default Application User" mysql |
| 93 | + |
| 94 | +# we need licenses from docs |
| 95 | +RUN set -ex; \ |
| 96 | + # systemd is required for nss-pam-ldap |
| 97 | + curl -Lf -o /tmp/nss-pam-ldapd.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/nss-pam-ldapd-0.9.9-3.el8.x86_64.rpm; \ |
| 98 | + rpmkeys --checksig /tmp/nss-pam-ldapd.rpm; \ |
| 99 | + rpm -iv /tmp/nss-pam-ldapd.rpm --nodeps; \ |
| 100 | + rm -rf /tmp/nss-pam-ldapd.rpm; \ |
| 101 | + curl -Lf -o /tmp/percona-xtrabackup-24.rpm https://repo.percona.com/pxb-24/yum/${PXC_REPO}/8/RPMS/x86_64/percona-xtrabackup-24-${FULL_PERCONA_XTRABACKUP_VERSION}.x86_64.rpm; \ |
| 102 | + rpmkeys --checksig /tmp/percona-xtrabackup-24.rpm /tmp/Percona-XtraDB-Cluster-server-57-${PXC_VERSION}.el8.x86_64.rpm /tmp/Percona-XtraDB-Cluster-shared-57-${PXC_VERSION}.el8.x86_64.rpm /tmp/Percona-XtraDB-Cluster-client-57-${PXC_VERSION}.el8.x86_64.rpm; \ |
| 103 | + rpm -iv /tmp/percona-xtrabackup-24.rpm --nodeps; \ |
| 104 | + rpm -iv /tmp/Percona-XtraDB-Cluster-shared-57-${PXC_VERSION}.el8.x86_64.rpm --nodeps; \ |
| 105 | + rpm -iv /tmp/Percona-XtraDB-Cluster-client-57-${PXC_VERSION}.el8.x86_64.rpm --nodeps; \ |
| 106 | + rpm -iv /tmp/Percona-XtraDB-Cluster-server-57-${PXC_VERSION}.el8.x86_64.rpm --nodeps; \ |
| 107 | + microdnf clean all; \ |
| 108 | + rm -rf /tmp/percona-xtrabackup-24.rpm /tmp/percona-xtradb-cluster-server.rpm /tmp/percona-xtradb-cluster-shared.rpm /tmp/percona-xtradb-cluster-client.rpm; \ |
| 109 | + rm -rf /usr/bin/mysqltest /usr/bin/perror /usr/bin/replace /usr/bin/resolve_stack_dump /usr/bin/resolveip; \ |
| 110 | + rm -rf /var/cache/dnf /var/cache/yum /var/lib/mysql /usr/lib64/mysql/plugin/debug /usr/sbin/mysqld-debug /usr/lib64/mecab /usr/lib64/mysql/mecab /usr/bin/myisam*; \ |
| 111 | + rpm -ql Percona-XtraDB-Cluster-client-57 | egrep -v "mysql$|mysqldump$" | xargs rm -rf |
| 112 | + |
| 113 | +COPY LICENSE /licenses/LICENSE.Dockerfile |
| 114 | +RUN cp /usr/share/doc/percona-xtradb-cluster-galera/COPYING /licenses/LICENSE.galera; \ |
| 115 | + cp /usr/share/doc/percona-xtradb-cluster-galera/LICENSE.* /licenses/ |
| 116 | + |
| 117 | +COPY dockerdir / |
| 118 | +COPY --from=go_builder /go/src/github.com/percona/percona-xtradb-cluster-operator/cmd/peer-list /usr/bin/ |
| 119 | + |
| 120 | +RUN set -ex; \ |
| 121 | + rm -rf /etc/my.cnf.d; \ |
| 122 | + ln -s /etc/mysql/conf.d /etc/my.cnf.d; \ |
| 123 | + rm -f /etc/percona-xtradb-cluster.conf.d/*.cnf; \ |
| 124 | + echo '!include /etc/mysql/node.cnf' > /etc/my.cnf; \ |
| 125 | + echo '!includedir /etc/my.cnf.d/' >> /etc/my.cnf; \ |
| 126 | + echo '!includedir /etc/percona-xtradb-cluster.conf.d/' >> /etc/my.cnf; \ |
| 127 | + mkdir -p /etc/mysql/conf.d/ /var/log/mysql /var/lib/mysql /docker-entrypoint-initdb.d; \ |
| 128 | + chown -R 1001:1001 /etc/mysql/ /var/log/mysql /var/lib/mysql /docker-entrypoint-initdb.d; \ |
| 129 | + chmod -R g=u /etc/mysql/ /var/log/mysql /var/lib/mysql /docker-entrypoint-initdb.d |
| 130 | + |
| 131 | +ARG DEBUG |
| 132 | +RUN if [[ -n $DEBUG ]] ; then \ |
| 133 | + set -ex; \ |
| 134 | + sed -i '/\[mysqld\]/a wsrep_log_conflicts\nlog_error_verbosity=3\nwsrep_debug=1' /etc/mysql/node.cnf; \ |
| 135 | + mv /usr/sbin/mysqld /usr/sbin/mysqld-ps; \ |
| 136 | + cp /usr/local/bin/mysqld-debug /usr/sbin/mysqld; \ |
| 137 | + microdnf install -y \ |
| 138 | + net-tools \ |
| 139 | + nc \ |
| 140 | + gdb; \ |
| 141 | + curl -Lf -o /tmp/telnet.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/telnet-0.17-76.el8.x86_64.rpm; \ |
| 142 | + curl -Lf -o /tmp/percona-xtradb-cluster-debuginfo.rpm https://repo.percona.com/pxc-57/yum/${PXC_REPO}/8/RPMS/x86_64/Percona-XtraDB-Cluster-57-debuginfo-${FULL_PERCONA_XTRADBCLUSTER_VERSION}.x86_64.rpm; \ |
| 143 | + curl -Lf -o /tmp/percona-xtradb-cluster-server-debuginfo.rpm https://repo.percona.com/pxc-57/yum/${PXC_REPO}/8/RPMS/x86_64/Percona-XtraDB-Cluster-server-57-debuginfo-${FULL_PERCONA_XTRADBCLUSTER_VERSION}.x86_64.rpm; \ |
| 144 | + rpmkeys --checksig /tmp/telnet.rpm /tmp/percona-xtradb-cluster-debuginfo.rpm /tmp/percona-xtradb-cluster-server-debuginfo.rpm; \ |
| 145 | + rpm -i /tmp/telnet.rpm /tmp/Percona-XtraDB-Cluster-57-debuginfo-${PXC_VERSION}.el8.x86_64.rpm /tmp/Percona-XtraDB-Cluster-server-57-debuginfo-${PXC_VERSION}.el8.x86_64.rpm --nodeps; \ |
| 146 | + rm -rf /tmp/*.rpm; \ |
| 147 | + microdnf clean all; \ |
| 148 | + rm -rf /var/cache/dnf /var/cache/yum; \ |
| 149 | +fi |
| 150 | + |
| 151 | +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh |
| 152 | +RUN chmod a+rx /call-home.sh |
| 153 | +RUN mkdir -p /usr/local/percona |
| 154 | +RUN chown mysql:mysql /usr/local/percona |
| 155 | +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" |
| 156 | + |
| 157 | +USER 1001 |
| 158 | + |
| 159 | +VOLUME ["/var/lib/mysql", "/var/log/mysql"] |
| 160 | + |
| 161 | +ENTRYPOINT ["/entrypoint.sh"] |
| 162 | + |
| 163 | +EXPOSE 3306 4567 4568 |
| 164 | +CMD ["mysqld"] |
0 commit comments