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 \ distcc-pump \ ccache \ clang \ curl \ gcc \ g++ \ build-essential # cleanup RUN apt-get autoremove -y EXPOSE 3632/tcp 3633/tcp HEALTHCHECK --interval=5m --timeout=3s \ CMD curl -f http://127.0.0.1:3633/ || exit 1 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" ]
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.