]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improvement and upgrade of Docker build (#278)
authorAnders Björklund <anders.f.bjorklund@gmail.com>
Sat, 5 Jan 2019 21:42:11 +0000 (22:42 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Jan 2019 21:42:11 +0000 (22:42 +0100)
Allow using different Docker images for testing ccache build in different build
environments.

base/README [new file with mode: 0644]
base/alpine/Dockerfile [new file with mode: 0644]
base/centos/Dockerfile [new file with mode: 0644]
base/debian/Dockerfile [moved from misc/Dockerfile with 63% similarity]
base/fedora/Dockerfile [new file with mode: 0644]
base/ubuntu/Dockerfile [new file with mode: 0644]
dev.mk.in
misc/build.sh [new file with mode: 0755]

diff --git a/base/README b/base/README
new file mode 100644 (file)
index 0000000..b411811
--- /dev/null
@@ -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 (file)
index 0000000..1d087fe
--- /dev/null
@@ -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 (file)
index 0000000..b2cddef
--- /dev/null
@@ -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
similarity index 63%
rename from misc/Dockerfile
rename to base/debian/Dockerfile
index 47f1ce1ea5e16dba9377488a0c980e14d39d72da..fece706671d5f0595d28ee5c8e7967cf8f0e931e 100644 (file)
@@ -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 (file)
index 0000000..db26fdc
--- /dev/null
@@ -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 (file)
index 0000000..8a86146
--- /dev/null
@@ -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/*
index 50576e538526b477242a370b8aa89d2fa743cd1f..14306b23a9285a13c9149861d60d86f47fde24be 100644 (file)
--- 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 (executable)
index 0000000..f46c699
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh -ex
+# doc/INSTALL.md
+./autogen.sh
+./configure
+make
+make ${*:-test}