Skip to content

Commit

Permalink
Add new Dockerfile for ubuntu 20.04
Browse files Browse the repository at this point in the history
  • Loading branch information
filipenf committed Oct 10, 2023
1 parent 275a7e6 commit 5bc8281
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mcrouter/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PKG_DIR="$1"
INSTALL_DIR="$2"
INSTALL_AUX_DIR="$3"
shift $#
MAKE_ARGS="$@ -j$(nproc)"
MAKE_ARGS="$@ -j4"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

mkdir -p "$PKG_DIR" "$INSTALL_DIR"
Expand Down
125 changes: 125 additions & 0 deletions mcrouter/scripts/docker/ubuntu/Dockerfile-20.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# syntax=docker/dockerfile:1.1-experimental
FROM ubuntu:20.04 as build

ENV DEBIAN_FRONTEND noninteractive

ENV MCROUTER_DIR /usr/local/mcrouter
ENV PKG_DIR $MCROUTER_DIR/pkgs
ENV INSTALL_DIR $MCROUTER_DIR/install
ENV INSTALL_AUX_DIR $MCROUTER_DIR/install/aux
ENV RECIPES_DIR $PKG_DIR/scripts/recipes
ENV LDFLAGS="-s -ljemalloc $LDFLAGS"

RUN apt -y update && \
apt -y install apt-transport-https \
ca-certificates \
tzdata \
git \
autoconf \
binutils-dev \
bison \
cmake \
flex \
g++ \
gcc \
git \
libboost1.71-all-dev \
libbz2-dev \
libdouble-conversion-dev \
libevent-dev \
libgflags-dev \
libgoogle-glog-dev \
libjemalloc-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
libsodium-dev \
libssl-dev \
libtool \
libunwind-dev \
make \
pkg-config \
python3-dev \
python-is-python3 \
ragel

COPY ./mcrouter/scripts/common.sh ${PKG_DIR}/scripts/common.sh
COPY ./mcrouter/scripts/recipes/gtest.sh ${PKG_DIR}/scripts/recipes/gtest.sh

RUN mkdir -p "$PKG_DIR" "$INSTALL_DIR" "$INSTALL_AUX_DIR"

WORKDIR $PKG_DIR/scripts

RUN ${RECIPES_DIR}/gtest.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

#RUN cd $MCROUTER_DIR && \
# ./repo/mcrouter/mcrouter/scripts/docker/ubuntu/scripts/build.sh
#mcrouter/scripts/docker/ubuntu/scripts/

FROM build as build-fmtlib

COPY ./mcrouter/scripts/recipes/fmtlib.sh ${PKG_DIR}/scripts/recipes/fmtlib.sh
RUN ${RECIPES_DIR}/fmtlib.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

####
FROM build as build-folly

COPY --from=build-fmtlib $INSTALL_DIR $INSTALL_DIR
COPY --from=build-fmtlib $PKG_DIR $PKG_DIR
COPY ./mcrouter/scripts/recipes/folly.sh ${PKG_DIR}/scripts/recipes/folly.sh

RUN ${RECIPES_DIR}/folly.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

FROM build as build-fizz

COPY --from=build-folly $INSTALL_DIR $INSTALL_DIR
COPY --from=build-folly $PKG_DIR $PKG_DIR
COPY ./mcrouter/scripts/recipes/fizz.sh ${PKG_DIR}/scripts/recipes/fizz.sh

RUN ${RECIPES_DIR}/fizz.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

FROM build as build-wangle

COPY --from=build-fizz $INSTALL_DIR $INSTALL_DIR
COPY --from=build-fizz $PKG_DIR $PKG_DIR
COPY ./mcrouter/scripts/recipes/wangle.sh ${PKG_DIR}/scripts/recipes/wangle.sh

RUN ${RECIPES_DIR}/wangle.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

FROM build as build-mvfst

ENV VERSION=11.1
COPY --from=build-wangle $INSTALL_DIR $INSTALL_DIR
COPY --from=build-wangle $PKG_DIR $PKG_DIR
COPY ./mcrouter/scripts/recipes/mvfst.sh ${PKG_DIR}/scripts/recipes/mvfst.sh

RUN CFLAGS="-pthread" ${RECIPES_DIR}/mvfst.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR || (cat $PKG_DIR/mvfst/CMakeFiles/CMake*.log; exit 1)

####
FROM build as build-fbthrift

COPY --from=build-mvfst $INSTALL_DIR $INSTALL_DIR
COPY --from=build-mvfst $PKG_DIR $PKG_DIR
COPY ./mcrouter/scripts/recipes/fbthrift.sh ${PKG_DIR}/scripts/recipes/fbthrift.sh

RUN ${RECIPES_DIR}/fbthrift.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR


###
FROM build as build-mcrouter

COPY --from=build-fbthrift $INSTALL_DIR $INSTALL_DIR
COPY --from=build-fbthrift $PKG_DIR $PKG_DIR

COPY ./mcrouter $MCROUTER_DIR/repo/mcrouter/

RUN echo "2022-10-02" > $MCROUTER_DIR/repo/mcrouter/VERSION

RUN $MCROUTER_DIR/repo/mcrouter/scripts/recipes/mcrouter.sh $PKG_DIR $INSTALL_DIR $INSTALL_AUX_DIR

RUN strip /usr/local/mcrouter/install/bin/mcrouter

FROM ubuntu:20.04 as final

COPY --from=build /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
COPY --from=build-mcrouter /usr/local/mcrouter/install/bin/mcrouter /usr/bin/
2 changes: 1 addition & 1 deletion mcrouter/scripts/recipes/fbthrift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
source common.sh

if [[ ! -d "$PKG_DIR/fbthrift" ]]; then
git clone https://github.com/facebook/fbthrift
git clone -b main https://github.com/facebook/fbthrift
cd "$PKG_DIR/fbthrift" || die "cd fail"
if [[ -f "$REPO_BASE_DIR/mcrouter/FBTHRIFT_COMMIT" ]]; then
FBTHRIFT_COMMIT="$(head -n 1 "$REPO_BASE_DIR/mcrouter/FBTHRIFT_COMMIT")"
Expand Down
2 changes: 1 addition & 1 deletion mcrouter/scripts/recipes/gtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source common.sh

if [ ! -d "$PKG_DIR/glog" ]; then
git clone https://github.com/google/googletest.git "$PKG_DIR/gtest" \
--branch v1.10.x --depth 1
--branch v1.13.x --depth 1
cd "$PKG_DIR/gtest" || die "cd fail"

cmake . \
Expand Down

0 comments on commit 5bc8281

Please sign in to comment.