This is a docker image containing the distributed compiler "distcc" meant to speed up the compilation of programs.
After building, execute:
docker run \
-it \
--restart=always \
-p 3632:3632 \
-p 3633:3633 \
wizardrysteamworks/distcc
where:
3632 is the distcc port,3633 is the distcc stats portHere is the corresponding Docker compose file:
version: "3.7"
services:
distcc:
image: wizardrysteamworks/distcc:latest
ports:
- "35001-35002:3632" # distcc
- "36001-36002:3633" # stats
healthcheck:
test: [ "CMD", "curl", "-f", "http://127.0.0.1:3633" ]
interval: 5m
timeout: 3s
deploy:
replicas: 2
. โโโ Dockerfile 1 directory, 1 file
FROM debian:stable-slim
# update package manager
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get dist-upgrade -y && \
apt-get -y autoremove && \
apt-get clean
# install required packages
RUN apt-get -y install \
supervisor \
ccache \
curl \
gcc \
g++ \
python3 \
python3-dev \
python3-distutils \
build-essential \
libiberty-dev
WORKDIR /tmp
RUN curl -fLs https://github.com/distcc/distcc/releases/download/v3.4/distcc-3.4.tar.gz -o /tmp/distcc-3.4.tar.gz && \
tar -xpvf distcc-3.4.tar.gz && rm distcc-3.4.tar.gz && \
cd distcc-3.4 && \
./configure \
--with-included-popt \
--without-gnome \
--without-gtk && \
make && \
make install
# cleanup
RUN apt-get purge -y \
curl && \
apt-get autoremove -y
# create distcc user
RUN groupadd --gid 1000 distcc && \
useradd -rm -d /tmp -s /bin/bash -g distcc -G distcc -u 1000 distcc
EXPOSE 3632/tcp 3633/tcp
ENTRYPOINT [ "distccd", "--daemon", "--no-detach", "--user", "distcc", "--port", "3632", "--stats", "--stats-port", "3633", "--log-level", "info", "--log-stderr", "--listen", "0.0.0.0", "--allow", "0.0.0.0/0", "--enable-tcp-insecure" ]
Typically the image will be distributed to a Docker swarm and ran for as many nodes available to compile programs. Then, when compiling, the hosts will be specified using the DISTCC_HOSTS environment variable. For example:
export DISTCC_HOSTS="docker1:35001 docker2:35002" CC=distcc CXX=distcc
where docker1 and docker2 represent hosts on which distcc will be running and 35001, respectively 35002 will be the corresponding ports.
The environment variables CC and CXX remap the C, respectively C++ compiler to distcc. Internally, the container is built to have clang as the compiler.
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.