diff options
author | Arnstein Ressem <aressem@yahoo-inc.com> | 2016-06-22 09:17:51 +0200 |
---|---|---|
committer | Arnstein Ressem <aressem@yahoo-inc.com> | 2016-06-22 09:17:51 +0200 |
commit | d966b0cd3cf8e72013793b3a83c07930d798d97e (patch) | |
tree | ce7cf6c9daba217f7cf2b1f5ab67bfcbb7d8338b /docker | |
parent | 73650afbb8132f94716de91ecd9e01794dca74f7 (diff) |
Added scripts for entering a build container.
Diffstat (limited to 'docker')
-rw-r--r-- | docker/Dockerfile.build | 3 | ||||
-rw-r--r-- | docker/README.md | 12 | ||||
-rwxr-xr-x | docker/enter-build-container-internal.sh | 23 | ||||
-rwxr-xr-x | docker/enter-build-container.sh | 16 |
4 files changed, 52 insertions, 2 deletions
diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build index e1df100cfa7..0f7f6935042 100644 --- a/docker/Dockerfile.build +++ b/docker/Dockerfile.build @@ -26,6 +26,9 @@ RUN yum -y install vespa-libtorrent-devel RUN yum -y install vespa-zookeeper-c-client-devel RUN yum -y install vespa-cppunit-devel +# Install utilities +RUN yum -y install sudo + # Enable devtoolset-4 by default RUN echo "source /opt/rh/devtoolset-4/enable" > /etc/profile.d/devtoolset-4.sh diff --git a/docker/README.md b/docker/README.md index 38809e6e3d5..a937cae8934 100644 --- a/docker/README.md +++ b/docker/README.md @@ -7,7 +7,7 @@ *On OS X, the native Docker engine (Beta) has NOT been tested. Please use the [Docker Toolbox](https://www.docker.com/products/docker-toolbox).* *On Linux, the default storage device is devicemapper with loopback device and max 10GB container size. This size is too small for a full build. Please see [here](http://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/) and [here](http://www.projectatomic.io/blog/2015/06/notes-on-fedora-centos-and-docker-storage-drivers/) to overcome this limitation. -## Building Vespa +## Building the Vespa RPM *On OS X, execute ```source osx-setup-docker-machine.sh``` to setup the Docker VM in which to run Docker.* Execute ```./build-vespa.sh <Vespa version number>``` to build Vespa from this source code. @@ -21,4 +21,12 @@ Execute ```./run-vespa.sh <Vespa version number>``` to start Vespa. This will create a Docker image which has the rpms from the build step installed. Vespa will be started inside the container. -*On OS X, the container runs inside the Docker VM. Execute ```docker-machine ssh vespa-docker-machine```to enter the VM.* +*On OS X, the container runs inside the Docker VM. Execute ```docker-machine ssh vespa-docker-machine``` to enter the VM.* + +## Building Vespa inside a Docker container +*On OS X, execute ```source osx-setup-docker-machine.sh``` to setup the Docker VM in which to run Docker.* + +Execute ```./enter-build-container.sh``` to enter the Vespa build environment inside a Docker container. + +The container is entered at the root of the Vespa source repository. Follow the build sections in [README.md](https://github.com/yahoo/vespa/blob/master/README.md) to build and test. + diff --git a/docker/enter-build-container-internal.sh b/docker/enter-build-container-internal.sh new file mode 100755 index 00000000000..1724b700572 --- /dev/null +++ b/docker/enter-build-container-internal.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +if [ $# -ne 0 ]; then + echo "Usage: $0" + echo "This script should not be called manually." + exit 1 +fi + +USERNAME=builder +DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +cd $DIR + +CALLER_UID=$(stat -c "%u" $DIR) +CALLER_GID=$(stat -c "%g" $DIR) + +groupadd -f -g $CALLER_GID $USERNAME +useradd -u $CALLER_UID -g $CALLER_GID $USERNAME +echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +cd $DIR/.. +su $USERNAME + diff --git a/docker/enter-build-container.sh b/docker/enter-build-container.sh new file mode 100755 index 00000000000..ed7a2b4a130 --- /dev/null +++ b/docker/enter-build-container.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +if [ $# -ne 0 ]; then + echo "Usage: $0" + exit 1 +fi + +DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +cd $DIR + +DOCKER_IMAGE="vespabuild" + +docker build -t "$DOCKER_IMAGE" -f Dockerfile.build . +docker run -ti --rm -v $(pwd)/..:/vespa --entrypoint /vespa/docker/enter-build-container-internal.sh "$DOCKER_IMAGE" + |