From 67c3f7a42e8cd59993a7adbe6dded8bd9f752b3f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Oct 2015 00:10:59 -0430 Subject: [PATCH 1/2] Add support fo Ubuntu 14.04 - This creates a new directory ./14.04, or ./12.04 - I'm not sure if this is the best way. See https://github.com/yammer/mcrouter-build-docker/issues/1 --- .gitignore | 1 + Dockerfile | 35 +++++++++++++++++++++++++++++++---- Makefile | 14 ++++++++++---- README.md | 7 +++++-- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index c00df13..2aeac67 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.deb +Dockerfile-* diff --git a/Dockerfile b/Dockerfile index d58acf8..a111d19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ -FROM ubuntu:12.04 +FROM ubuntu:__RELEASE__ MAINTAINER Brian Morton "bmorton@yammer-inc.com" ENV MCROUTER_VERSION 0.9 ENV MCROUTER_SHA e1d90728efc109f1c7258d36b641264a56bd04a8 ENV FOLLY_SHA f63b080574f6a139c952fe2a0c06f16fdf170042 +ENV RELEASE 14.04 + # Install tools needed by install scripts below RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections @@ -16,8 +18,33 @@ RUN curl -L https://github.com/facebook/mcrouter/archive/${MCROUTER_SHA}.tar.gz # Build folly, a dependency of mcrouter WORKDIR /tmp/folly-${FOLLY_SHA}/folly -RUN apt-get -y update && ./build/deps_ubuntu_12.04.sh -RUN apt-get -y install libboost-program-options1.54-dev +RUN apt-get -y update && if [ ${RELEASE} = "12.04" ]; then \ + ./build/deps_ubuntu_12.04.sh && apt-get -y install libboost-program-options1.54-dev; else \ + apt-get install -y \ + software-properties-common \ + python-software-properties \ + autoconf \ + binutils-dev \ + g++ \ + gcc \ + git \ + libboost-context1.54-dev \ + libboost-filesystem1.54-dev \ + libboost-program-options1.54-dev \ + libboost-regex1.54-dev \ + libboost-system1.54-dev \ + libboost-thread1.54-dev \ + libboost1.54-dev \ + libdouble-conversion-dev \ + libevent-dev \ + libgflags-dev \ + libgoogle-glog-dev \ + libssl-dev \ + libtool \ + make \ + python-dev \ + ragel; \ +fi RUN autoreconf -ivf && ./configure RUN make -j4 RUN make install @@ -26,7 +53,7 @@ RUN make install WORKDIR /tmp/mcrouter-${MCROUTER_SHA}/mcrouter ENV LDFLAGS -Wl,-rpath=/usr/local/lib/mcrouter/ ENV LD_LIBRARY_PATH /usr/local/lib/mcrouter/ -RUN mkdir /tmp/mcrouter-build && ./scripts/install_ubuntu_12.04.sh /tmp/mcrouter-build -j4 +RUN mkdir /tmp/mcrouter-build && ./scripts/install_ubuntu_${RELEASE}.sh /tmp/mcrouter-build -j4 # Install Ruby so we can install fpm for building the Debian package RUN add-apt-repository ppa:brightbox/ruby-ng diff --git a/Makefile b/Makefile index 470c472..2badc6c 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,21 @@ VERSION = `grep "ENV MCROUTER_VERSION" Dockerfile | cut -f3 -d' '` SHA = `grep "ENV MCROUTER_SHA" Dockerfile | cut -f3 -d' '` +RELEASE = `grep "ENV RELEASE" Dockerfile | cut -f3 -d' '` .PHONY: all build cp -all: build cp +all: build cp build: - docker build -t mcrouter . + sed "1 s/__RELEASE__/${RELEASE}/" Dockerfile > Dockerfile-${RELEASE} + docker build --no-cache -t mcrouter -f Dockerfile-${RELEASE} . cp: - docker create --name=mcrouter-build mcrouter && docker cp mcrouter-build:/tmp/mcrouter-build/install/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb . && docker rm -f mcrouter-build + mkdir ./${RELEASE} + docker create --name=mcrouter-build mcrouter && docker cp mcrouter-build:/tmp/mcrouter-build/install/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb ./${RELEASE}/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb && docker rm -f mcrouter-build test: - docker run -ti --rm -v `pwd`:/opt/mcrouter-build ubuntu:12.04 sh -c "dpkg -i /opt/mcrouter-build/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb; mcrouter --version; /bin/bash" + docker run -ti --rm -v `pwd`:/opt/mcrouter-build ubuntu:${RELEASE} sh -c "dpkg -i /opt/mcrouter-build/yammer-mcrouter_${VERSION}-${SHA}_amd64.deb; mcrouter --version; /bin/bash" + +clean: + rm -f Dockerfile-* diff --git a/README.md b/README.md index d75d070..a5c7fb2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # mcrouter package builder -This `Dockerfile` will create a `.deb` package for [mcrouter](https://github.com/facebook/mcrouter) for use on Ubuntu 12.04. Yammer uses this package to deploy mcrouter to its production environments. +This `Dockerfile` will create a `.deb` package for [mcrouter](https://github.com/facebook/mcrouter) for use on Ubuntu 12.04 or 14.04. Yammer uses this package to deploy mcrouter to its production environments. ## Building @@ -10,7 +10,7 @@ To build and copy the package to your local filesystem, run `make`. ## Testing package -To start up a new 12.04 Docker container with the built package installed, run `make test`. +To start up a new Ubuntu Docker container with the built package installed, run `make test`. ## Updating @@ -19,3 +19,6 @@ For updating to a new version of mcrouter, update the `MCROUTER_VERSION` and `MCROUTER_SHA` environment variables in the `Dockerfile`. You'll probably have to update the `FOLLY_SHA` variable as well since mcrouter usually depends on the latest version of Folly. + +To specify the Ubuntu release version for the docker container, update the environment +variable `RELEASE` in the Dockerfile. Valid options are `12.04` or `14.04` currently. From 72e61ddc910abf81227b845542b7a9c024e1ffa1 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Oct 2015 00:17:24 -0430 Subject: [PATCH 2/2] Remove --no-cache option which was temporary --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2badc6c..f8690f4 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: build cp build: sed "1 s/__RELEASE__/${RELEASE}/" Dockerfile > Dockerfile-${RELEASE} - docker build --no-cache -t mcrouter -f Dockerfile-${RELEASE} . + docker build -t mcrouter -f Dockerfile-${RELEASE} . cp: mkdir ./${RELEASE}