From f31027298b7a97e0f79d86d308eb1f8537e31f5f Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 3 May 2020 21:13:33 +0100 Subject: [PATCH] Add autotools build to localbuild docker images. --- other/docker/autotools/Dockerfile | 23 +++++++++++ other/docker/cmake/Dockerfile | 38 +++++++++++++++++++ other/docker/run-ci | 22 +++++++---- .../{Dockerfile.ci => travis/Dockerfile} | 11 ------ 4 files changed, 75 insertions(+), 19 deletions(-) create mode 100644 other/docker/autotools/Dockerfile create mode 100644 other/docker/cmake/Dockerfile rename other/docker/{Dockerfile.ci => travis/Dockerfile} (80%) diff --git a/other/docker/autotools/Dockerfile b/other/docker/autotools/Dockerfile new file mode 100644 index 00000000000..b8b4c95cc3e --- /dev/null +++ b/other/docker/autotools/Dockerfile @@ -0,0 +1,23 @@ +################################################ +# autotools-linux +FROM localbuild/travis + +USER root +RUN apt-get update && apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + libtool \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +USER travis + +# Copy minimal files to run "autotools-linux install", so we can avoid +# rebuilding nacl and other things when only source files change. +RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache +WORKDIR /home/travis/build/c-toxcore +COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ +RUN .travis/autotools-linux install + +# Now copy the rest of the sources and run the build. +COPY --chown=travis:travis . /home/travis/build/ +RUN .travis/autotools-linux script diff --git a/other/docker/cmake/Dockerfile b/other/docker/cmake/Dockerfile new file mode 100644 index 00000000000..7f4d44c50af --- /dev/null +++ b/other/docker/cmake/Dockerfile @@ -0,0 +1,38 @@ +################################################ +# cmake-linux +FROM localbuild/travis + +# Copy minimal files to run "cmake-linux install", so we can avoid rebuilding +# astyle and other things when only source files change. +RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache +WORKDIR /home/travis/build/c-toxcore +COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ +RUN .travis/cmake-linux install + +# Now copy the rest of the sources and run the build. +COPY --chown=travis:travis . /home/travis/build/ +RUN .travis/cmake-linux script + +################################################ +# autotools-linux +FROM travis AS autotools + +USER root +RUN apt-get update && apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + libtool \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +USER travis + +# Copy minimal files to run "cmake-linux install", so we can avoid rebuilding +# astyle and other things when only source files change. +RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache +WORKDIR /home/travis/build/c-toxcore +COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ +RUN .travis/autotools-linux install + +# Now copy the rest of the sources and run the build. +COPY --chown=travis:travis . /home/travis/build/ +RUN .travis/autotools-linux script diff --git a/other/docker/run-ci b/other/docker/run-ci index 9005cfbd4db..deec1182fae 100755 --- a/other/docker/run-ci +++ b/other/docker/run-ci @@ -1,15 +1,21 @@ #!/bin/bash -set -eu +set -eux + +STAGE="${1-cmake}" readarray -t FILES <<<"$(git ls-files | sed -e 's,^,c-toxcore/,')" +FILES+=(c-toxcore/.git) + if [ -f .git ]; then - cd .. - tar -c "${FILES[@]}" "c-toxcore/.git" ".git/modules/c-toxcore" | - docker build -f c-toxcore/other/docker/Dockerfile.ci - -else - cd .. - tar -c "${FILES[@]}" "c-toxcore/.git" | - docker build -f c-toxcore/other/docker/Dockerfile.ci - + FILES+=(.git/modules/c-toxcore) fi + +cd .. +tar -c "${FILES[@]}" | + docker build -f "c-toxcore/other/docker/travis/Dockerfile" \ + -t localbuild/travis - +tar -c "${FILES[@]}" | + docker build -f "c-toxcore/other/docker/$STAGE/Dockerfile" \ + -t "localbuild/$STAGE" - diff --git a/other/docker/Dockerfile.ci b/other/docker/travis/Dockerfile similarity index 80% rename from other/docker/Dockerfile.ci rename to other/docker/travis/Dockerfile index db7e5e2ceed..f02be75f4ef 100644 --- a/other/docker/Dockerfile.ci +++ b/other/docker/travis/Dockerfile @@ -62,14 +62,3 @@ USER travis ENV CC=gcc CXX=g++ \ PATH=/home/travis/.local/bin:$PATH \ TRAVIS_REPO_SLUG=TokTok/c-toxcore - -# Copy minimal files to run "cmake-linux install", so we can avoid rebuilding -# astyle and other things when only source files change. -RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache -WORKDIR /home/travis/build/c-toxcore -COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ -RUN .travis/cmake-linux install - -# Now copy the rest of the sources and run the build. -COPY --chown=travis:travis . /home/travis/build/ -RUN .travis/cmake-linux script