From: Anders Björklund Date: Sat, 5 Jan 2019 21:42:11 +0000 (+0100) Subject: Improvement and upgrade of Docker build (#278) X-Git-Tag: v3.6~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6be163bffe090d7dfc48d83c96005f548308bc7f;p=thirdparty%2Fccache.git Improvement and upgrade of Docker build (#278) Allow using different Docker images for testing ccache build in different build environments. --- diff --git a/base/README b/base/README new file mode 100644 index 000000000..b41181116 --- /dev/null +++ b/base/README @@ -0,0 +1,7 @@ +This directory contains base images, for building and testing. + +They have all the requirements needed, as per: doc/INSTALL.md + +Build them with "make docker BASE=ubuntu" after doing configure. + +You can also download them with "docker pull ccache/build:$BASE" diff --git a/base/alpine/Dockerfile b/base/alpine/Dockerfile new file mode 100644 index 000000000..1d087fe30 --- /dev/null +++ b/base/alpine/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:latest + +RUN apk add --no-cache \ + gcc libc-dev \ + make \ + bash \ + asciidoc \ + autoconf \ + gperf \ + zlib-dev \ + ## diff --git a/base/centos/Dockerfile b/base/centos/Dockerfile new file mode 100644 index 000000000..b2cddef94 --- /dev/null +++ b/base/centos/Dockerfile @@ -0,0 +1,14 @@ +FROM centos:latest + +# note: graphviz adds libX11... :'‑( +RUN yum install -y \ + gcc \ + make \ + bash \ + asciidoc \ + autoconf \ + gperf \ + zlib-devel \ + && rpm -e --nodeps graphviz \ + && yum autoremove -y \ + && yum clean all diff --git a/misc/Dockerfile b/base/debian/Dockerfile similarity index 63% rename from misc/Dockerfile rename to base/debian/Dockerfile index 47f1ce1ea..fece70667 100644 --- a/misc/Dockerfile +++ b/base/debian/Dockerfile @@ -1,18 +1,11 @@ -FROM ubuntu:16.04 +FROM debian:latest RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ make \ + bash \ + asciidoc xsltproc docbook-xml docbook-xsl \ autoconf \ gperf \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* - -WORKDIR /tmp/build - -COPY . . - -RUN ./autogen.sh \ - && ./configure \ - && make \ - && make test diff --git a/base/fedora/Dockerfile b/base/fedora/Dockerfile new file mode 100644 index 000000000..db26fdc30 --- /dev/null +++ b/base/fedora/Dockerfile @@ -0,0 +1,14 @@ +FROM fedora:latest + +# note: graphviz adds libX11... :'‑( +RUN dnf install -y \ + gcc \ + make findutils \ + bash \ + asciidoc \ + autoconf \ + gperf \ + zlib-devel \ + && rpm -e --nodeps graphviz \ + && dnf autoremove -y \ + && dnf clean all diff --git a/base/ubuntu/Dockerfile b/base/ubuntu/Dockerfile new file mode 100644 index 000000000..8a86146e6 --- /dev/null +++ b/base/ubuntu/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:latest + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc \ + make \ + bash \ + asciidoc xsltproc docbook-xml docbook-xsl \ + autoconf \ + gperf \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* diff --git a/dev.mk.in b/dev.mk.in index 50576e538..14306b23a 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -235,9 +235,13 @@ analyze: $(SCAN_BUILD) --use-cc=$(CC) $(srcdir)/configure $(SCAN_BUILD) --use-cc=$(CC) --status-bugs $(MAKE) -B +BASE=ubuntu +TAG=ccache/build:$(BASE) + .PHONY: docker -docker: misc/Dockerfile - $(DOCKER) build -f $< $(srcdir) +docker: base/$(BASE)/Dockerfile + $(DOCKER) inspect $(TAG) >/dev/null || $(DOCKER) build -t $(TAG) base/$(BASE) + $(DOCKER) run --rm -v $(PWD):/build -w /build $(TAG) misc/build.sh $(TEST) .PHONY: travis travis: .travis/Dockerfile diff --git a/misc/build.sh b/misc/build.sh new file mode 100755 index 000000000..f46c69942 --- /dev/null +++ b/misc/build.sh @@ -0,0 +1,6 @@ +#!/bin/sh -ex +# doc/INSTALL.md +./autogen.sh +./configure +make +make ${*:-test}