Skip to content

Commit

Permalink
Add support fo Ubuntu 14.04
Browse files Browse the repository at this point in the history
- This creates a new directory ./14.04, or ./12.04
- I'm not sure if this is the best way.
  See yammer#1
  • Loading branch information
root committed Oct 19, 2015
1 parent 293200c commit 67c3f7a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.deb
Dockerfile-*
35 changes: 31 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM ubuntu:12.04
FROM ubuntu:__RELEASE__
MAINTAINER Brian Morton "[email protected]"

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
Expand All @@ -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
Expand All @@ -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
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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-*
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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.

0 comments on commit 67c3f7a

Please sign in to comment.