forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split off bootstrap into separate Docker image.
This makes it faster to use Docker images to test new changes, as suggested in vitessio#492. Since we don't need to re-bootstrap for every push to master, this also makes our automated builds faster and more reliable (they often fail due to network lag when installing dependencies with apt-get). Lastly, this will make it easier to swap out bootstrap images built for different flavors, such as MariaDB 10.0 vs MySQL 5.6.
- Loading branch information
Showing
6 changed files
with
125 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,12 @@ | ||
FROM golang:1.4-wheezy | ||
FROM vitess/bootstrap:mariadb | ||
|
||
# Install Vitess build dependencies | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
automake \ | ||
bison \ | ||
bzip2 \ | ||
curl \ | ||
g++ \ | ||
git \ | ||
libssl-dev \ | ||
libtool \ | ||
make \ | ||
memcached \ | ||
mercurial \ | ||
openjdk-7-jre-headless \ | ||
pkg-config \ | ||
python-dev \ | ||
python-mysqldb \ | ||
python-software-properties \ | ||
python-pip \ | ||
python-virtualenv \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install MariaDB 10.0.x | ||
RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db && \ | ||
add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/debian wheezy main' && \ | ||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server libmariadbclient-dev | ||
|
||
# Add VOLUME | ||
VOLUME /vt/vtdataroot | ||
|
||
# Load files from directory containing Dockerfile | ||
# Re-copy sources from working tree | ||
COPY . /vt/src/github.com/youtube/vitess | ||
|
||
# Create vitess user | ||
RUN groupadd -r vitess && useradd -r -g vitess vitess && \ | ||
chown -R vitess:vitess /vt | ||
|
||
# Compile and install required packages as root | ||
WORKDIR /vt/src/github.com/youtube/vitess | ||
RUN ./travis/install_grpc.sh | ||
|
||
# Bootstrap Vitess | ||
ENV MYSQL_FLAVOR MariaDB | ||
# Fix permissions | ||
USER root | ||
RUN chown -R vitess:vitess /vt | ||
USER vitess | ||
RUN ./bootstrap.sh --skip_root_installs | ||
|
||
# Set up environment (equivalent to '. dev.env') | ||
ENV VTTOP /vt/src/github.com/youtube/vitess | ||
ENV VTROOT /vt | ||
ENV GOTOP $VTTOP/go | ||
ENV PYTOP $VTTOP/py | ||
ENV VTDATAROOT $VTROOT/vtdataroot | ||
ENV VTPORTSTART 15000 | ||
ENV PYTHONPATH $VTROOT/dist/py-cbson/lib/python2.7/site-packages:$VTROOT/dist/py-vt-bson-0.3.2/lib/python2.7/site-packages:$VTROOT/py-vtdb | ||
ENV GOBIN $VTROOT/bin | ||
ENV GOPATH $VTROOT | ||
ENV PATH $VTROOT/bin:$PATH | ||
ENV VT_MYSQL_ROOT /usr | ||
ENV PKG_CONFIG_PATH $VTROOT/lib | ||
ENV CGO_CFLAGS -I$VTROOT/dist/vt-zookeeper-3.3.5/include/c-client-src | ||
ENV CGO_LDFLAGS -L$VTROOT/dist/vt-zookeeper-3.3.5/lib | ||
ENV LD_LIBRARY_PATH $VTROOT/dist/vt-zookeeper-3.3.5/lib | ||
|
||
# Build Vitess | ||
RUN make build | ||
|
||
# If the user doesn't specify a command, load a shell. | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
FROM golang:1.4-wheezy | ||
|
||
# Install Vitess build dependencies | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
automake \ | ||
bison \ | ||
bzip2 \ | ||
curl \ | ||
g++ \ | ||
git \ | ||
libssl-dev \ | ||
libtool \ | ||
make \ | ||
memcached \ | ||
mercurial \ | ||
openjdk-7-jre-headless \ | ||
pkg-config \ | ||
python-dev \ | ||
python-mysqldb \ | ||
python-software-properties \ | ||
python-pip \ | ||
python-virtualenv \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install gRPC as root | ||
RUN cd /tmp && \ | ||
git clone https://github.com/grpc/grpc.git && cd grpc && \ | ||
git submodule update --init && \ | ||
make install && \ | ||
CONFIG=opt tools/run_tests/build_python.sh && \ | ||
pip install -r src/python/requirements.txt && \ | ||
pip install src/python/src | ||
|
||
# Create mount point for actual data (e.g. MySQL data dir) | ||
VOLUME /vt/vtdataroot | ||
|
||
# Set up Vitess environment (equivalent to '. dev.env') | ||
ENV VTTOP /vt/src/github.com/youtube/vitess | ||
ENV VTROOT /vt | ||
ENV GOTOP $VTTOP/go | ||
ENV PYTOP $VTTOP/py | ||
ENV VTDATAROOT $VTROOT/vtdataroot | ||
ENV VTPORTSTART 15000 | ||
ENV PYTHONPATH $VTROOT/dist/py-cbson/lib/python2.7/site-packages:$VTROOT/dist/py-vt-bson-0.3.2/lib/python2.7/site-packages:$VTROOT/py-vtdb | ||
ENV GOBIN $VTROOT/bin | ||
ENV GOPATH $VTROOT | ||
ENV PATH $VTROOT/bin:$PATH | ||
ENV VT_MYSQL_ROOT /usr | ||
ENV PKG_CONFIG_PATH $VTROOT/lib | ||
ENV CGO_CFLAGS -I$VTROOT/dist/vt-zookeeper-3.3.5/include/c-client-src | ||
ENV CGO_LDFLAGS -L$VTROOT/dist/vt-zookeeper-3.3.5/lib | ||
ENV LD_LIBRARY_PATH $VTROOT/dist/vt-zookeeper-3.3.5/lib | ||
|
||
# Copy files needed for bootstrap | ||
COPY . /vt/src/github.com/youtube/vitess | ||
|
||
# Create vitess user | ||
RUN groupadd -r vitess && useradd -r -g vitess vitess && \ | ||
chown -R vitess:vitess /vt | ||
|
||
# If the user doesn't specify a command, load a shell. | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM vitess/bootstrap:common | ||
|
||
# Install MariaDB 10.0.x | ||
RUN apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db && \ | ||
add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/debian wheezy main' && \ | ||
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server libmariadbclient-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Bootstrap Vitess | ||
WORKDIR /vt/src/github.com/youtube/vitess | ||
USER vitess | ||
ENV MYSQL_FLAVOR MariaDB | ||
RUN ./bootstrap.sh --skip_root_installs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Bootstrap Images | ||
|
||
These Dockerfiles create images that contain everything Vitess expects to have | ||
after successfully running `bootstrap.sh` and `dev.env`. | ||
|
||
The `vitess/bootstrap` image comes in different flavors: | ||
* `vitess/bootstrap:common` - dependencies that are common to all flavors | ||
* `vitess/bootstrap:mariadb` - bootstrap image for MariaDB | ||
|
||
**NOTE: Unlike the base image that builds Vitess itself, this bootstrap image | ||
will NOT be rebuilt automatically on every push to the Vitess master branch.** | ||
|
||
To build a new bootstrap image, use the `docker_bootstrap` make rule. | ||
For example: | ||
|
||
``` | ||
~/src/github.com/youtube/vitess$ make docker_bootstrap flavor=mariadb | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
flavor=$1 | ||
|
||
if [[ -z "$flavor" ]]; then | ||
echo "Flavor must be specified as first argument." | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -f bootstrap.sh ]]; then | ||
echo "This script should be run from the root of the Vitess source tree - e.g. ~/src/github.com/youtube/vitess" | ||
exit 1 | ||
fi | ||
|
||
# To avoid AUFS permission issues, files must allow access by "other" | ||
chmod -R o=g * | ||
|
||
docker build -f docker/bootstrap/Dockerfile.$flavor -t vitess/bootstrap:$flavor . |