summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2018-01-31 23:11:52 +0200
committerAndres Gomez <agomez@igalia.com>2018-02-06 11:42:50 +0200
commit2e0ef4346c29f45d1444ef0564439653deb4e025 (patch)
tree1c90a610a7645f2430bb03f527db281c103d1b3a /docker
parent6fefc0b59b2f04884095f5226854f865e379fec7 (diff)
travis: add docker based cmake build job
Until now we were only running the python unit tests. It seems desirable to also check that the CMake based build compiles successfully. We do that now using docker. The docker build can be tweaked with some environment variables and, also, be stored in the docker hub if desired. Check the changes for extra details regarding these variables. v2: Removed other build possibilities other than just from inside Travis-CI, as suggested by Juan. v3: Replaced the "RELEASE" parameter to create the docker image with "PARENT" and removed some unneeded documentation after v2, as suggested by Juan. v4: - Use DOCKER_PARENT, DOCKER_IMAGE and DOCKER_TAG variables from the custom Travis-CI setup to define the PARENT, IMAGE and TAG parameters during the docker image creation. - Upload the image only if DOCKER_IMAGE and DOCKER_TAG are set. Cc: Dylan Baker <dylan@pnwbakers.com> Cc: Juan A. Suarez <jasuarez@igalia.com> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/Rockerfile.piglit74
1 files changed, 74 insertions, 0 deletions
diff --git a/docker/Rockerfile.piglit b/docker/Rockerfile.piglit
new file mode 100644
index 000000000..0d8f8bb45
--- /dev/null
+++ b/docker/Rockerfile.piglit
@@ -0,0 +1,74 @@
+#
+# This builds Piglit.
+#
+# ~~~
+# rocker build -f Rockerfile.piglit [--attach] \
+# [--var IMAGE=freedesktop/mesa] # freedesktop/mesa, myrepo/myproyect, ... \
+# [--var TAG=piglit] # piglit-17.0, piglit-13.0, ... \
+# [--var PARENT=ubuntu:xenial] # ubuntu:xenial, freedesktop/mesa:17.3, ...
+# ~~~
+#
+# Environment variables that are used in the build:
+# - MAKEFLAGS: flags to pass to make (e.g., "-j8")
+# - CCACHE_DIR: ccache directory (default: ~/.ccache)
+#
+# To run
+#
+# ~~~
+# mkdir -p -m777 ~/my_results_dir
+# docker run --privileged --rm -t -v ~/my_results_dir:/results:Z \
+# -v /tmp/.X11-unix:/tmp/.X11-unix freedesktop/mesa:piglit
+# ~~~
+#
+
+{{ $image := (or .IMAGE "freedesktop/mesa") }}
+{{ $parent_image := (or .PARENT "ubuntu:xenial") }}
+{{ $ccachedir := (or .Env.CCACHE_DIR "~/.ccache") }}
+
+FROM {{ $parent_image }}
+
+LABEL maintainer "Andres Gomez <agomez@igalia.com>"
+
+USER root
+
+ENV LC_ALL=C.UTF-8
+
+RUN apt-get update \
+ && apt-get -y --no-install-recommends install sudo gcc g++ ccache \
+ git pkg-config bash-completion cmake \
+ libz-dev libpng-dev libgl-dev libegl1-mesa-dev libwaffle-dev \
+ python3-setuptools python3-pip \
+ && rm -fr /var/lib/apt/lists/*
+
+RUN pip3 install numpy six mako
+
+RUN getent passwd local > /dev/null || adduser --gecos "" local && passwd -d local && adduser local sudo
+
+USER local
+
+{{ if .Env.MAKEFLAGS }}
+ENV MAKEFLAGS={{ .Env.MAKEFLAGS }}
+{{ end }}
+
+WORKDIR /home/local
+
+MOUNT {{ $ccachedir }}:/home/local/.ccache:Z
+
+RUN sudo chown -R local:local /home/local/.ccache
+
+ENV PATH=/usr/lib/ccache:$PATH
+
+ADD . /home/local/piglit
+RUN sudo chown -R local:local /home/local/piglit
+
+WORKDIR /home/local/piglit
+
+ATTACH [ "/bin/bash" ]
+
+RUN cmake . && cmake --build .
+
+VOLUME /results
+
+{{ if .TAG }}
+TAG {{ $image }}:{{ .TAG }}
+{{ end }}