cinaq/distcc
Run distcc with local caching to super charge your c(++) builds
178
Run distcc with local caching to super charge your c(++) builds
Business case:
Result: 50% time reduction
Edit resources.yaml
to fit your environment. Pay special attention to the service. By default it is exposed via a LoadBalancer so that weak nodes can leverage distcc nodes in a Kubernetes cluster
kubectl apply -f resources.yaml
Next create a Dockerfile
:
FROM debian:stable AS builder
WORKDIR /root
ENV ORTHANC_VERSION 1.6.0
RUN apt update
RUN apt install -y build-essential unzip cmake mercurial \
uuid-dev libcurl4-openssl-dev liblua5.1-0-dev \
libgtest-dev libpng-dev libjpeg-dev \
libsqlite3-dev libssl-dev zlib1g-dev libdcmtk2-dev \
libboost-all-dev libwrap0-dev libjsoncpp-dev libpugixml-dev distcc
# pull source from upstream
RUN hg clone -b Orthanc-${ORTHANC_VERSION} --stream https://bitbucket.org/sjodogne/orthanc Orthanc
# distcc
ARG JOBS=4
ARG DISTCC_HOSTS=localhost/4
RUN echo "${DISTCC_HOSTS}" > /etc/distcc/hosts
RUN mkdir OrthancBuild
RUN cd OrthancBuild && cmake -DALLOW_DOWNLOADS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=distcc \
-DUSE_SYSTEM_CIVETWEB=OFF \
-DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=OFF \
-DDCMTK_LIBRARIES=dcmjpls \
-DCMAKE_BUILD_TYPE=Release \
~/Orthanc
RUN cd OrthancBuild && make -j ${JOBS}
Let's build with the support of distcc in Kubernetes. Don't forget to replace LOADBALANCER_ADDRESS
with the External address of kubectl get svc distcc
:
docker build . --build-arg DISTCC_HOSTS=LOADBALANCER_ADDRESS/4 --build-arg JOBS=4 -t orthanc
kubectl logs $distcc_pod
to confirm your build is hitting distcc
servicekubectl exec -it $distcc_pod -- /bin/ls -l /cache/
docker pull cinaq/distcc