From 4170be37ce9c358cf540dcafaa212393853abae7 Mon Sep 17 00:00:00 2001 From: Anthony Yeh Date: Thu, 19 May 2016 12:50:28 -0700 Subject: [PATCH] Add Docker images for MySQL 5.7. --- Dockerfile | 2 +- Dockerfile.mysql56 | 12 ++++++++++ Makefile | 8 +++++++ docker/bootstrap/Dockerfile.mysql57 | 14 +++++++++++ docker/lite/Dockerfile | 2 +- docker/lite/Dockerfile.mysql56 | 37 +++++++++++++++++++++++++++++ test.go | 2 +- 7 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.mysql56 create mode 100644 docker/bootstrap/Dockerfile.mysql57 create mode 100644 docker/lite/Dockerfile.mysql56 diff --git a/Dockerfile b/Dockerfile index 2d29c920b2..187a535663 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM vitess/bootstrap:mysql56 +FROM vitess/bootstrap:mysql57 # Re-copy sources from working tree USER root diff --git a/Dockerfile.mysql56 b/Dockerfile.mysql56 new file mode 100644 index 0000000000..2d29c920b2 --- /dev/null +++ b/Dockerfile.mysql56 @@ -0,0 +1,12 @@ +FROM vitess/bootstrap:mysql56 + +# Re-copy sources from working tree +USER root +COPY . /vt/src/github.com/youtube/vitess + +# Fix permissions +RUN chown -R vitess:vitess /vt +USER vitess + +# Build Vitess +RUN make build diff --git a/Makefile b/Makefile index de69ad27db..e55f3a8c46 100644 --- a/Makefile +++ b/Makefile @@ -118,6 +118,7 @@ docker_bootstrap: docker/bootstrap/build.sh common docker/bootstrap/build.sh mariadb docker/bootstrap/build.sh mysql56 + docker/bootstrap/build.sh mysql57 docker/bootstrap/build.sh percona docker_base: @@ -125,6 +126,10 @@ docker_base: chmod -R o=g * docker build -t vitess/base . +docker_base_mysql56: + chmod -R o=g * + docker build -f Dockerfile.percona -t vitess/base:mysql56 . + docker_base_percona: chmod -R o=g * docker build -f Dockerfile.percona -t vitess/base:percona . @@ -136,6 +141,9 @@ docker_base_mariadb: docker_lite: cd docker/lite && ./build.sh +docker_lite_mysql56: + cd docker/lite && ./build.sh mysql56 + docker_lite_mariadb: cd docker/lite && ./build.sh mariadb diff --git a/docker/bootstrap/Dockerfile.mysql57 b/docker/bootstrap/Dockerfile.mysql57 new file mode 100644 index 0000000000..33b1f9d49d --- /dev/null +++ b/docker/bootstrap/Dockerfile.mysql57 @@ -0,0 +1,14 @@ +FROM vitess/bootstrap:common + +# Install MySQL 5.7 +RUN apt-key adv --recv-keys --keyserver ha.pool.sks-keyservers.net 5072E1F5 && \ + add-apt-repository 'deb http://repo.mysql.com/apt/debian/ jessie mysql-5.7' && \ + apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server libmysqlclient-dev && \ + rm -rf /var/lib/apt/lists/* + +# Bootstrap Vitess +WORKDIR /vt/src/github.com/youtube/vitess +USER vitess +ENV MYSQL_FLAVOR MySQL56 +RUN ./bootstrap.sh --skip_root_installs diff --git a/docker/lite/Dockerfile b/docker/lite/Dockerfile index 516cc3faae..8faffa797c 100644 --- a/docker/lite/Dockerfile +++ b/docker/lite/Dockerfile @@ -3,7 +3,7 @@ FROM debian:jessie # Install dependencies RUN apt-key adv --recv-keys --keyserver pgp.mit.edu 5072E1F5 \ - && echo 'deb http://repo.mysql.com/apt/debian/ jessie mysql-5.6' > /etc/apt/sources.list.d/mysql.list \ + && echo 'deb http://repo.mysql.com/apt/debian/ jessie mysql-5.7' > /etc/apt/sources.list.d/mysql.list \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install -y --no-install-recommends \ diff --git a/docker/lite/Dockerfile.mysql56 b/docker/lite/Dockerfile.mysql56 new file mode 100644 index 0000000000..516cc3faae --- /dev/null +++ b/docker/lite/Dockerfile.mysql56 @@ -0,0 +1,37 @@ +# This image is only meant to be built from within the build.sh script. +FROM debian:jessie + +# Install dependencies +RUN apt-key adv --recv-keys --keyserver pgp.mit.edu 5072E1F5 \ + && echo 'deb http://repo.mysql.com/apt/debian/ jessie mysql-5.6' > /etc/apt/sources.list.d/mysql.list \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends \ + bzip2 \ + memcached \ + libmysqlclient18 \ + mysql-client \ + mysql-server \ + && rm -rf /var/lib/apt/lists/* + +# Set up Vitess environment (just enough to run pre-built Go binaries) +ENV VTTOP /vt/src/github.com/youtube/vitess +ENV VTROOT /vt +ENV GOTOP $VTTOP/go +ENV VTDATAROOT $VTROOT/vtdataroot +ENV GOBIN $VTROOT/bin +ENV GOPATH $VTROOT +ENV PATH $VTROOT/bin:$PATH +ENV VT_MYSQL_ROOT /usr +ENV PKG_CONFIG_PATH $VTROOT/lib +ENV LD_LIBRARY_PATH $VTROOT/dist/vt-zookeeper-3.4.6/lib + +# Copy binaries (placed by build.sh) +COPY lite/vt /vt + +# Create vitess user +RUN groupadd -r vitess && useradd -r -g vitess vitess && \ + mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt + +# Create mount point for actual data (e.g. MySQL data dir) +VOLUME /vt/vtdataroot diff --git a/test.go b/test.go index c2d0cac0df..a8c13db946 100755 --- a/test.go +++ b/test.go @@ -63,7 +63,7 @@ For example: // Flags var ( - flavor = flag.String("flavor", "mysql56", "bootstrap flavor to run against") + flavor = flag.String("flavor", "mysql57", "bootstrap flavor to run against") runCount = flag.Int("runs", 1, "run each test this many times") retryMax = flag.Int("retry", 3, "max number of retries, to detect flaky tests") logPass = flag.Bool("log-pass", false, "log test output even if it passes")