From 917e7e313118f81f4f03504fa41d336ace957ef1 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 6 May 2024 18:25:55 -0600 Subject: [PATCH 1/3] add mysqlbinlog and its libaries to the lite image Signed-off-by: Florent Poinsard --- docker/lite/Dockerfile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docker/lite/Dockerfile b/docker/lite/Dockerfile index ccbff94f225..ea30331be72 100644 --- a/docker/lite/Dockerfile +++ b/docker/lite/Dockerfile @@ -18,13 +18,20 @@ # Use a temporary layer for the build stage. ARG bootstrap_version=31 -ARG image="vitess/bootstrap:${bootstrap_version}-mysql80" +ARG image="vitess/bootstrap:${bootstrap_version}-common" FROM "${image}" AS builder # Allows docker builds to set the BUILD_NUMBER ARG BUILD_NUMBER +# Install mysql +USER root +RUN apt-get update && apt-get install -y xz-utils +RUN wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz +RUN tar -xf mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz +RUN mv mysql-8.0.37-linux-glibc2.12-x86_64 mysql-generic-binaries + # Re-copy sources from working tree. COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess @@ -34,13 +41,10 @@ USER vitess RUN make install PREFIX=/vt/install # Start over and build the final image. -FROM debian:bullseye-slim - -# Install mysqlbinglog -RUN apt-get update && apt-get -y install libssl1.1 gnupg -COPY --from=builder /usr/bin/mysqlbinlog /usr/bin/mysqlbinlog +FROM --platform=linux/amd64 debian:bullseye-slim # Install xtrabackup +RUN apt-get update && apt-get -y install gnupg RUN apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 9334A25F8507EFA5 RUN echo 'deb http://repo.percona.com/apt bullseye main' > /etc/apt/sources.list.d/percona.list RUN apt-get update -y @@ -61,6 +65,9 @@ COPY --from=builder --chown=vitess:vitess /vt/install /vt COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/init_db.sql /vt/config/ COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/mycnf /vt/config/ +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/bin/mysqlbinlog /vt/bin/mysqlbinlog +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libcrypto.so.3 /vt/lib/libcrypto.so.3 +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libssl.so.3 /vt/lib/libssl.so.3 # Create mount point for actual data (e.g. MySQL data dir) VOLUME /vt/vtdataroot From 6f2f4fa833a98bb2471b2ee28b826105ebe84b64 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 6 May 2024 18:34:12 -0600 Subject: [PATCH 2/3] fix path of the libraries Signed-off-by: Florent Poinsard --- docker/lite/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/lite/Dockerfile b/docker/lite/Dockerfile index ea30331be72..73d4ef54bda 100644 --- a/docker/lite/Dockerfile +++ b/docker/lite/Dockerfile @@ -55,19 +55,19 @@ RUN groupadd -r vitess && useradd -r -g vitess vitess RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt # Set up Vitess environment (just enough to run pre-built Go binaries) -ENV VTROOT /vt/src/vitess.io/vitess -ENV VTDATAROOT /vt/vtdataroot +ENV VTROOT /vt +ENV VTDATAROOT $VTROOT/vtdataroot ENV PATH $VTROOT/bin:$PATH # Copy artifacts from builder layer. COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=builder --chown=vitess:vitess /vt/install /vt -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin /vt/web/vtadmin -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/init_db.sql /vt/config/ -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/mycnf /vt/config/ -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/bin/mysqlbinlog /vt/bin/mysqlbinlog -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libcrypto.so.3 /vt/lib/libcrypto.so.3 -COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libssl.so.3 /vt/lib/libssl.so.3 +COPY --from=builder --chown=vitess:vitess /vt/install $VTROOT +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/web/vtadmin $VTROOT/web/vtadmin +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/init_db.sql $VTROOT/config/ +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/config/mycnf $VTROOT/config/ +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/bin/mysqlbinlog $VTROOT/bin/mysqlbinlog +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libcrypto.so.3 $VTROOT/lib/private/libcrypto.so.3 +COPY --from=builder --chown=vitess:vitess /vt/src/vitess.io/vitess/mysql-generic-binaries/lib/private/libssl.so.3 $VTROOT/lib/private/libssl.so.3 # Create mount point for actual data (e.g. MySQL data dir) VOLUME /vt/vtdataroot From cf70a7e1bfef09caa16bbe27644b53f05ae1f7c2 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 6 May 2024 22:02:07 -0600 Subject: [PATCH 3/3] fix comment Signed-off-by: Florent Poinsard --- docker/lite/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/lite/Dockerfile b/docker/lite/Dockerfile index 73d4ef54bda..7e2ff3e20a4 100644 --- a/docker/lite/Dockerfile +++ b/docker/lite/Dockerfile @@ -25,7 +25,7 @@ FROM "${image}" AS builder # Allows docker builds to set the BUILD_NUMBER ARG BUILD_NUMBER -# Install mysql +# Download linux generic mysql USER root RUN apt-get update && apt-get install -y xz-utils RUN wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.37-linux-glibc2.12-x86_64.tar.xz