initial commit

This commit is contained in:
surtur 2022-01-19 17:29:03 +01:00
commit a599451c4f
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
6 changed files with 152 additions and 0 deletions

19
.hadolint.yaml Normal file

@ -0,0 +1,19 @@
failure-threshold: warning
ignored:
# updated nightly so this is irrelevant
- DL3039
# DL3041 warning: Specify version with `dnf install -y <package>-<version>`.
- DL3041
# DL3040 warning: `dnf clean all` missing after dnf command.
- DL3040
# SC2039 warning: In POSIX sh, brace expansion is undefined.
# it actually still works
- SC2039
no-fail: true
override:
info:
# SC3009 warning: In POSIX sh, brace expansion is undefined.
- SC3009

7
.pre-commit-config.yaml Normal file

@ -0,0 +1,7 @@
---
fail_fast: false
repos:
- repo: https://github.com/hadolint/hadolint
rev: v2.8.0
hooks:
- id: hadolint

74
Dockerfile Normal file

@ -0,0 +1,74 @@
# syntax=docker/dockerfile:1.3
FROM registry.fedoraproject.org/fedora:35
ARG BUILD_DATE
ARG VCS_REF
LABEL description="Container image for distributed building of C/C++ programs on Fedora using distcc"
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-url="https://git.dotya.ml/wanderer/docker-fedora-distcc.git" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.license=GPL-3.0
# hadolint shell=/usr/bin/bash
RUN printf "[main]\ngpg_check=1\ninstallonly_limit=2\nclean_requirements_on_remove=True\nfastestmirror=True\nmax_parallel_downloads=7\n" > /etc/dnf/dnf.conf; \
cat /etc/dnf/dnf.conf; \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled updates && \
dnf config-manager --set-enabled updates-testing && \
dnf --refresh upgrade -y
# hadolint ignore DL3059
RUN dnf install --nodocs dnf dnf-plugins-core -y && \
dnf copr enable eddsalkield/iwyu -y && \
dnf install --nodocs --setopt install_weak_deps=0 -y \
git \
ninja-build \
make \
{c,auto}make \
gcc \
gcc-c++ \
libgcc \
libstdc++-{devel,static} \
glibc-devel \
clang \
distcc \
distcc-server \
iwyu \
cryptopp-devel \
libasan-static \
liblsan-static \
libubsan-static \
libtsan-static \
binutils \
lld \
flex \
bison \
which \
file \
protobuf-c-{devel,compiler} \
protobuf-compiler \
cppunit \
capnproto-{devel,libs} \
libpcap-devel \
kernel-devel \
&& dnf clean all -y
ENTRYPOINT ["distccd", \
"--daemon", \
"--no-detach", \
"--user", "distcc", \
"--port", "3632", \
"--stats", \
"--stats-port", "3633", \
"--log-stderr", \
"--listen", "0.0.0.0"\
]
# By default the distcc server will accept clients from everywhere.
CMD ["--allow", "0.0.0.0/0", \
"--nice", "3", \
"--jobs", "6" \
]

34
Makefile Normal file

@ -0,0 +1,34 @@
dcmd = docker
dfile = Dockerfile
dtag = immawanderer/fedora-distcc:testbuild
dargs = build -t $(dtag) --no-cache --pull - < $(dfile)
cleanargs = image rm -f $(dtag)
pruneargs = system prune -af
dargskaniko = run --rm -it -w=$(kanikowdir) -v $$PWD:$(kanikowdir)
kanikoexecutorimg = gcr.io/kaniko-project/executor:v1.7.0-debug
kanikowdir = /src
kanikocontext = .
kanikoargs = -f=$(dfile) -c=$(kanikocontext) --use-new-run --snapshotMode=redo --build-arg BUILD_DATE=$(build_date) --build-arg VCS_REF=$(vcs_ref) --no-push
vcs_ref = $$(git rev-parse --short HEAD)
build_date= $$(date -u +"%Y-%m-%dT%H:%M:%SZ")
hadolintimg = hadolint/hadolint:v2.8.0-alpine
hadolintargs = run --rm -i -v $$PWD/.hadolint.yaml:/root/.config/hadolint.yaml
.PHONY: hadolint build kaniko clean test prune
hadolint:
$(dcmd) $(hadolintargs) $(hadolintimg) < $(dfile)
kaniko:
$(dcmd) $(dargskaniko) $(kanikoexecutorimg) $(kanikoargs)
build:
$(dcmd) $(dargs)
clean:
$(dcmd) $(cleanargs)
test: hadolint build kaniko
prune:
$(dcmd) $(pruneargs)

7
README.md Normal file

@ -0,0 +1,7 @@
# docker-fedora-distcc
This repository provides a Dockerfile to create a container image for distributed building of C/C++ programs on Fedora using distcc.
The image is rebuilt nightly to ensure it always has the latest packages.
development happens on [this Gitea instance](https://git.dotya.ml/wanderer/docker-fedora-distcc)

11
hooks/build Normal file

@ -0,0 +1,11 @@
#!/bin/bash
# as per https://github.com/rossf7/label-schema-automated-build
# $IMAGE_NAME var is injected into the build so the tag is correct.
export DOCKER_BUILDKIT=1
echo "Build hook running"
docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
-t $IMAGE_NAME .