Open biancoari opened 2 years ago
Any Update?
no response from the community, any plans on making a package for focal?
I implemented the Dockerfile this winter. Haven't tested that with the latest versions and with Ubuntu for a while. With almalinux it worked till the end of May, but now doesn't. Seems like it's due to some dependency update (fmt/fbthrift, etc. mcrouter scripts are using the master versions from github. Searching for a solution at the moment)
I didn't find docs on how mcrouter is actually built from these tags that are cut, as the latest release is really really old, so managed to do it with this Dockerfile. This is for focal, and builds a distroless image; other versions might need some other sed stuff or apt packages. Although I managed to pin some software used, not everything is pinned, so expect this to be broken occasionally as stuff goes in to some dependencies that are cloned from their main branch.
FROM ubuntu:focal AS base
# Prevents TZ data prompt
ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y git sudo tzdata && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM base as builder
# Clone the repo
WORKDIR /workspace
# this is the latest tag from https://github.com/facebook/mcrouter/tags
ENV PIN_TAG=v2023.07.03.00
RUN git clone --depth 1 --branch $PIN_TAG https://github.com/facebook/mcrouter.git
# reduce concurrency to 1 as the build process is memory hungry and can fail in some CIs
RUN sed -i 's/ -j3 / -j1 -w /g' /workspace/mcrouter/mcrouter/scripts/get_and_build_by_make.sh
RUN sed -i 's/MAKE_ARGS="\$@ -j\$(nproc)"/MAKE_ARGS=" -j1 -w "/g' /workspace/mcrouter/mcrouter/scripts/common.sh
# pin fmtlib as master fails to build
RUN sed -i 's#https://github.com/fmtlib/fmt#--depth 1 --branch 10.0.0 https://github.com/fmtlib/fmt#' /workspace/mcrouter/mcrouter/scripts/recipes/fmtlib.sh
# pin all repos to the same tag
RUN echo $PIN_TAG > /workspace/mcrouter/mcrouter/FBTHRIFT_COMMIT && \
echo $PIN_TAG > /workspace/mcrouter/mcrouter/FIZZ_COMMIT && \
echo $PIN_TAG > /workspace/mcrouter/mcrouter/FOLLY_COMMIT && \
echo $PIN_TAG > /workspace/mcrouter/mcrouter/WANGLE_COMMIT
WORKDIR /workspace/mcrouter
# Install mcrouter from source
RUN mkdir -p /build
# reduce concurrency to 1 as the build process is memory hungry and can fail in some CIs
ENV MAKE_ARGS=' -j1 -w '
ENV CXXFLAGS=' -w '
# if not done, version will be .0 which breaks php getStats
RUN echo 41:1 > /workspace/mcrouter/mcrouter/VERSION
RUN mcrouter/scripts/install_ubuntu_20.04.sh /build
# Get all the linked libraries for mcrouter and copy them to /lib
RUN ldd /build/install/bin/mcrouter | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /build/install/lib
FROM base
ENV LD_LIBRARY_PATH=/mcrouter/lib
WORKDIR /mcrouter
COPY --from=builder /build/install /mcrouter
RUN ln -s /mcrouter/bin/mcrouter /usr/local/bin/mcrouter
USER 1000:1000
CMD ["mcrouter", "--version"]
I didn't find docs on how mcrouter is actually built from these tags that are cut, as the latest release is really really old, so managed to do it with this Dockerfile.
Great work, it builds fine. Do you maintain this Docker file in a repo ? (for instance if you update the pinning on a regular basis)
Thanks
Hi,
I've been trying to get in touch with the MCROUTER community with 0 success, I've been trying to build mcrouter in ubuntu20 for the past couple of day, I've used their installer (https://github.com/facebook/mcrouter/blob/main/mcrouter/scripts/install_ubuntu_20.04.sh) and I've also used the docker file (https://github.com/facebook/mcrouter/blob/main/mcrouter/scripts/docker/ubuntu/Dockerfile)
This is the tail that I get when trying a docker build of that dockerfile:
Does anybody had any success with mcrouter and ubuntu20?
Thanks!