summaryrefslogtreecommitdiff
path: root/other/docker
diff options
context:
space:
mode:
Diffstat (limited to 'other/docker')
-rw-r--r--other/docker/Dockerfile.ci75
-rwxr-xr-xother/docker/run-ci15
2 files changed, 90 insertions, 0 deletions
diff --git a/other/docker/Dockerfile.ci b/other/docker/Dockerfile.ci
new file mode 100644
index 00000000..db7e5e2c
--- /dev/null
+++ b/other/docker/Dockerfile.ci
@@ -0,0 +1,75 @@
1# This Docker build emulates roughly what Travis CI is doing. It is not exactly
2# the same (different tool versions) and success in this image may not
3# necessarily mean success on Travis. This image is also not automatically
4# tested, so it may get out of date. Send PRs if you use it and it's broken.
5#
6# For one, we use bionic, not xenial, because xenial's clang is way too old.
7FROM ubuntu:16.04
8
9# Travis environment.
10RUN apt-get update && apt-get install --no-install-recommends -y \
11 apt-transport-https \
12 build-essential \
13 ca-certificates \
14 curl \
15 git \
16 pkg-config \
17 python-pip \
18 python-setuptools \
19 python3 \
20 software-properties-common \
21 wget \
22 && apt-get clean \
23 && rm -rf /var/lib/apt/lists/*
24
25RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
26 && apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" \
27 && apt-get update && apt-get install --no-install-recommends -y \
28 clang-6.0 \
29 clang-format-6.0 \
30 llvm-6.0 \
31 && apt-get clean \
32 && rm -rf /var/lib/apt/lists/*
33
34RUN ls /usr/bin/clang-6.0 && ln -s /usr/bin/clang-6.0 /usr/bin/clang \
35 && ls /usr/bin/clang++-6.0 && ln -s /usr/bin/clang++-6.0 /usr/bin/clang++ \
36 && ls /usr/bin/clang-format-6.0 && ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format \
37 && ls /usr/bin/opt-6.0 && ln -s /usr/bin/opt-6.0 /usr/bin/opt
38
39# Bionic's cmake is too old.
40RUN pip install --upgrade pip cmake
41
42# .travis.yml
43RUN apt-get update && apt-get install --no-install-recommends -y \
44 libconfig-dev \
45 libgtest-dev \
46 libopus-dev \
47 libsodium-dev \
48 libvpx-dev \
49 ninja-build \
50 pylint3 \
51 && apt-get clean \
52 && rm -rf /var/lib/apt/lists/*
53
54# Set up travis user.
55RUN groupadd -r -g 1000 travis \
56 && useradd --no-log-init -r -g travis -u 1000 travis \
57 && mkdir -p /src/workspace /home/travis \
58 && chown travis:travis /home/travis
59USER travis
60
61# Set up environment.
62ENV CC=gcc CXX=g++ \
63PATH=/home/travis/.local/bin:$PATH \
64TRAVIS_REPO_SLUG=TokTok/c-toxcore
65
66# Copy minimal files to run "cmake-linux install", so we can avoid rebuilding
67# astyle and other things when only source files change.
68RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache
69WORKDIR /home/travis/build/c-toxcore
70COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/
71RUN .travis/cmake-linux install
72
73# Now copy the rest of the sources and run the build.
74COPY --chown=travis:travis . /home/travis/build/
75RUN .travis/cmake-linux script
diff --git a/other/docker/run-ci b/other/docker/run-ci
new file mode 100755
index 00000000..9005cfbd
--- /dev/null
+++ b/other/docker/run-ci
@@ -0,0 +1,15 @@
1#!/bin/bash
2
3set -eu
4
5readarray -t FILES <<<"$(git ls-files | sed -e 's,^,c-toxcore/,')"
6
7if [ -f .git ]; then
8 cd ..
9 tar -c "${FILES[@]}" "c-toxcore/.git" ".git/modules/c-toxcore" |
10 docker build -f c-toxcore/other/docker/Dockerfile.ci -
11else
12 cd ..
13 tar -c "${FILES[@]}" "c-toxcore/.git" |
14 docker build -f c-toxcore/other/docker/Dockerfile.ci -
15fi