GithubHelp home page GithubHelp logo

ksmanis / docker-gentoo-distcc Goto Github PK

View Code? Open in Web Editor NEW
29.0 2.0 3.0 333 KB

Decrease Gentoo compilation times by leveraging spare resources

Home Page: https://hub.docker.com/r/ksmanis/gentoo-distcc

License: MIT License

Dockerfile 55.52% Shell 37.46% C 2.57% jq 4.45%
docker gentoo distcc ssh

docker-gentoo-distcc's Introduction

Gentoo Docker image with distcc

Docker Pulls build lint pre-commit enabled Renovate enabled Conventional Commits

Decrease Gentoo compilation times by leveraging spare resources, such as an Ubuntu or Windows box idling around. Docker is the only prerequisite.

Features

  • Flexible deployment
    • Locally (in a private network)
    • Remotely (over the internet)
  • Out-of-the-box support for the following Gentoo architectures:
    • amd64
    • arm
    • arm64
    • ppc64
    • x86

Note: Only the stable toolchain of these architectures is currently supported.

Usage

distcc can run over TCP or SSH connections. TCP connections are fast but relatively insecure, whereas SSH connections are secure but slower. In a trusted environment, such as a LAN, you should use TCP connections for efficiency; otherwise use SSH connections.

TCP

On the worker node(s), run the containerized distcc server (distccd):

docker run -d -p 3632:3632 --name gentoo-distcc-tcp --rm ksmanis/gentoo-distcc:tcp

distccd should now be accessible from all interfaces at port 3632 (0.0.0.0:3632):

$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
405bb6e87ce8        ksmanis/gentoo-distcc:tcp   "tini -e 143 -- dock…"   2 seconds ago       Up 2 seconds        0.0.0.0:3632->3632/tcp   gentoo-distcc-tcp

Command-line arguments are passed on verbatim to distccd. For instance, you can turn on the built-in HTTP statistics server:

docker run -d -p 3632-3633:3632-3633 --name gentoo-distcc-tcp --rm ksmanis/gentoo-distcc:tcp --stats

The statistics server should now be accessible from all interfaces at port 3633 (0.0.0.0:3633):

$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                              NAMES
4e553e359782        ksmanis/gentoo-distcc:tcp   "tini -e 143 -- dock…"   3 seconds ago       Up 2 seconds        0.0.0.0:3632-3633->3632-3633/tcp   gentoo-distcc-tcp

For a full list of options refer to distccd(1).

SSH

On the worker node(s), run the containerized SSH server (sshd):

docker run -d -p 30022:22 -e AUTHORIZED_KEYS="..." --name gentoo-distcc-ssh --rm ksmanis/gentoo-distcc:ssh

sshd should now be accessible from all interfaces at port 30022 (0.0.0.0:30022):

$ docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                   NAMES
5aa87c1eaf59        ksmanis/gentoo-distcc:ssh   "docker-entrypoint.sh"   3 seconds ago       Up 2 seconds        0.0.0.0:30022->22/tcp   gentoo-distcc-ssh

Instead of including the public key verbatim in the above command, you may prefer to read it from a file on the Docker host:

docker run -d -p 30022:22 -e AUTHORIZED_KEYS="$(cat /path/to/key.pub)" --name gentoo-distcc-ssh --rm ksmanis/gentoo-distcc:ssh

Command-line arguments are passed on verbatim to sshd. For a full list of options refer to sshd(8).

Security

The SSH server allows only public key authentication. More specifically, only the distcc-ssh user is accessible with the public key provided with the required AUTHORIZED_KEYS environment variable. The username is configurable through the optional SSH_USERNAME environment variable:

docker run -d -p 30022:22 -e SSH_USERNAME=bob -e AUTHORIZED_KEYS="..." --name gentoo-distcc-ssh --rm ksmanis/gentoo-distcc:ssh

Testing

A manual way to test the containers is to compile a sample C file:

#include <stdio.h>

int main() {
    printf("Hello, distcc!\n");
    return 0;
}

TCP

DISTCC_HOSTS="127.0.0.1:3632" DISTCC_VERBOSE=1 distcc gcc -c main.c -o /dev/null

SSH

DISTCC_HOSTS="@localhost-distcc" DISTCC_VERBOSE=1 distcc gcc -c main.c -o /dev/null

The localhost-distcc host should be properly set up in your ~/.ssh/config:

Host localhost-distcc
    HostName 127.0.0.1
    Port 30022
    User distcc-ssh
    IdentityFile ~/.ssh/distcc
    StrictHostKeyChecking no

Note: StrictHostKeyChecking no is required in the above configuration because the host keys of the container are automatically regenerated upon execution, if missing. If you wish to eliminate this potential security issue, you should store the host keys in a volume and mount them upon execution so that they are not regenerated.

docker-gentoo-distcc's People

Contributors

dependabot[bot] avatar ksmanis avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-gentoo-distcc's Issues

Gentoo stable is on GCC 12

But latest docker image as of 06.02.2023 is still on GCC 11.3:

cd /usr/x86_64-pc-linux-gnu/gcc-bin/
9d1134fe7aba /usr/x86_64-pc-linux-gnu/gcc-bin # ls
11.3.0

Could you move to GCC 12?

Periodic hello.c compilation

Hello! I'm testing this out to use on my home server, and I see the following log line indicating that the server keeps compiling what I assume is the sample program in the tests dir:

distccd[8] (dcc_job_summary) client: 127.0.0.1:46724 COMPILE_OK exit:0 sig:0 core:0 ret:0 time:50ms gcc hello.c

I'd rather not compile hello world every so often; is this behavior intentional? If so, is there a way to disable it? Thanks so much! This is a very helpful resource :)

Does not work with Podman :(

Probably not your images' fault, cause happens same with my custom image. Works on docker but not on podman. Same command, same image.

You know any fix? Tried on fedora 37

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
docker-compose.test.yml
dockerfile
Dockerfile
  • docker/dockerfile 1.9.0@sha256:fe40cf4e92cd0c467be2cfc30657a680ae2398318afd50b0c80585784c604f28
  • ksmanis/stage3 20240812@sha256:40cf4acf6ecd59b08cde4647fb7cdac53270381293dfaf3f8207e345749af38e
github-actions
.github/workflows/build.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • docker/setup-qemu-action v3@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
  • docker/setup-buildx-action v3@988b5a0280414f521da01fcc63a27aeeb4b104db
  • docker/metadata-action v5@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
  • docker/build-push-action v6@5cd11c3a4ced054e52742c5fd54dca954e0edd85
  • docker/build-push-action v6@5cd11c3a4ced054e52742c5fd54dca954e0edd85
  • docker/login-action v3@9780b0c442fbb1117ed29e0efdff1e18412f7567
  • docker/login-action v3@9780b0c442fbb1117ed29e0efdff1e18412f7567
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • docker/login-action v3@9780b0c442fbb1117ed29e0efdff1e18412f7567
  • docker/login-action v3@9780b0c442fbb1117ed29e0efdff1e18412f7567
.github/workflows/dockerhub-description.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • peter-evans/dockerhub-description v4@e98e4d1628a5f3be2be7c231e50981aee98723ae
.github/workflows/lint.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/super-linter v5.0.0@45fc0d88288beee4701c62761281edfee85655d7
pre-commit
.pre-commit-config.yaml
  • pre-commit/pre-commit-hooks v4.6.0
  • hadolint/hadolint v2.12.0
  • jorisroovers/gitlint v0.19.1
  • rhysd/actionlint v1.7.1
  • pre-commit/pre-commit-hooks v4.6.0
  • executablebooks/mdformat 0.7.17
  • igorshubovych/markdownlint-cli v0.41.0
  • shellcheck-py/shellcheck-py v0.10.0.1
  • adrienverge/yamllint v1.35.1
regex
Dockerfile
  • krallin/tini 0.19.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.