diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index b43cccab5..75a40ad4c 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -5,9 +5,6 @@ FROM ubuntu:22.04 # variable prevents this interaction. ARG DEBIAN_FRONTEND=noninteractive -# Copy prebuilt packages. -COPY docker/packages /packages/ - # CodeCompass development dependencies. RUN set -x && apt-get update -qq \ && apt-get -y install --no-install-recommends \ @@ -15,6 +12,7 @@ RUN set -x && apt-get update -qq \ default-jdk \ universal-ctags \ curl ca-certificates gnupg \ + wget \ doxygen \ gcc-11 gcc-11-plugin-dev g++-11 \ libboost-filesystem-dev \ @@ -29,11 +27,19 @@ RUN set -x && apt-get update -qq \ libssl-dev \ llvm-11 clang-11 llvm-11-dev libclang-11-dev \ libsqlite3-dev \ - postgresql-server-dev-14 \ - /packages/*.deb && \ + postgresql-server-dev-14 && \ ln -s /usr/bin/gcc-11 /usr/bin/gcc && \ ln -s /usr/bin/g++-11 /usr/bin/g++ +# Copy install scripts +COPY docker/dev/install_odb.sh docker/dev/install_thrift.sh / + +# Build ODB from source +RUN sh /install_odb.sh && rm /install_odb.sh + +# Build Thrift 0.13 from source +RUN sh /install_thrift.sh && rm /install_thrift.sh + # Install NodeJS from NodeSource. RUN mkdir -p /etc/apt/keyrings && \ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ @@ -65,7 +71,7 @@ ENV DATABASE=sqlite \ TEST_WORKSPACE=/CodeCompass/test_workspace \ TEST_DB="sqlite:database=$TEST_WORKSPACE/cc_test.sqlite" \ WITH_AUTH="plain;ldap" \ - LLVM_DIR=/usr/lib/llvm-11/cmake + LLVM_DIR=/usr/lib/llvm-11/cmake \ Clang_DIR=/usr/lib/cmake/clang-11 ENV PATH="$INSTALL_DIR/bin:$PATH" diff --git a/docker/dev/install_odb.sh b/docker/dev/install_odb.sh new file mode 100644 index 000000000..a9647c0dd --- /dev/null +++ b/docker/dev/install_odb.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +opt=${1:-"all"} + +wget https://raw.githubusercontent.com/Ericsson/CodeCompass/master/scripts/install_latest_build2.sh +sh install_latest_build2.sh "/build2_install" +export PATH=/build2_install/bin:$PATH +# Configuring the build +mkdir /odb_build +cd /odb_build +bpkg create --quiet --jobs $(nproc) cc \ + config.cxx=g++ \ + config.cc.coptions=-O3 \ + config.bin.rpath=/odb_install/lib \ + config.install.root=/odb_install +# Getting the source +bpkg add https://pkg.cppget.org/1/beta --trust-yes +bpkg fetch --trust-yes +# Building odb +bpkg build libodb --yes +case $opt in + "sqlite") + bpkg build libodb-sqlite --yes + ;; + "pgsql") + bpkg build libodb-pgsql --yes + ;; + *) + bpkg build odb --yes + bpkg build libodb-sqlite --yes + bpkg build libodb-pgsql --yes + ;; +esac +bpkg install --all --recursive +# Copy to /usr +cp -rn /odb_install/* /usr +# Clean up +cd / +sh install_latest_build2.sh --uninstall +rm -rf /odb_build /odb_install install_latest_build2.sh build2-toolchain-*.tar.gz \ No newline at end of file diff --git a/docker/dev/install_thrift.sh b/docker/dev/install_thrift.sh new file mode 100644 index 000000000..a81ee4463 --- /dev/null +++ b/docker/dev/install_thrift.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +wget "http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=thrift/0.13.0/thrift-0.13.0.tar.gz" \ +-O thrift-0.13.0.tar.gz +tar -xvf ./thrift-0.13.0.tar.gz +cd thrift-0.13.0 +# Configure +./configure --prefix=/thrift_install --silent --without-python \ + --enable-libtool-lock --enable-tutorial=no --enable-tests=no \ + --with-libevent --with-zlib --without-nodejs --without-lua \ + --without-ruby --without-csharp --without-erlang --without-perl \ + --without-php --without-php_extension --without-dart \ + --without-haskell --without-go --without-rs --without-haxe \ + --without-dotnetcore --without-d --without-qt4 --without-qt5 \ + --without-java +make install -j $(nproc) +# Copy to /usr +cp -rn /thrift_install/* /usr +# Clean up +cd / +rm -rf /thrift_install thrift-0.13.0.tar.gz thrift-0.13.0 \ No newline at end of file diff --git a/docker/runtime/Dockerfile b/docker/runtime/Dockerfile index 8b8171724..4004c1423 100644 --- a/docker/runtime/Dockerfile +++ b/docker/runtime/Dockerfile @@ -51,26 +51,20 @@ ARG DEBIAN_FRONTEND=noninteractive ARG CC_DATABASE ENV CC_DATABASE ${CC_DATABASE} -COPY --from=builder /packages/lib* /packages/ +# Copy install scripts +COPY docker/dev/install_odb.sh docker/dev/install_thrift.sh / RUN apt-get update -qq && \ - apt-get install -qq --yes --no-install-recommends \ - /packages/libodb-2.5.deb \ - /packages/libodb-dev.deb && \ if [ "pgsql" = "${CC_DATABASE}" ]; then \ apt-get install -qq --yes --no-install-recommends \ libpq5 \ - /packages/libodb-pgsql-2.5.deb \ - /packages/libodb-pgsql-dev.deb \ postgresql-server-dev-14; \ else \ apt-get install -qq --yes --no-install-recommends \ - /packages/libsqlite3-1.deb \ - /packages/libodb-sqlite-2.5.deb \ - /packages/libodb-sqlite-dev.deb \ libsqlite3-dev; \ - fi; - + fi && \ + sh /install_odb.sh "${CC_DATABASE}" + RUN set -x && apt-get update -qq && \ apt-get install -qq --yes --no-install-recommends \ llvm-11 \ @@ -81,14 +75,15 @@ RUN set -x && apt-get update -qq && \ libgvc6 \ libldap-2.5-0 \ libmagic-dev \ - /packages/libthrift-0.13.0.deb \ - /packages/libthrift-dev.deb \ universal-ctags \ tini && \ apt-get clean && \ rm -rf /var/lib/apt/lists/ && \ set +x +# Install Thrift 0.13 from source +RUN sh /install_thrift.sh && rm /install_thrift.sh + # Copy CodeCompass installed directory. (Change permission of the CodeCompass package.) COPY --from=builder /CodeCompass-install /codecompass diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile index 8e514d0f8..d9eabef8b 100644 --- a/docker/web/Dockerfile +++ b/docker/web/Dockerfile @@ -15,7 +15,8 @@ FROM ubuntu:22.04 # variable prevents this interaction. ARG DEBIAN_FRONTEND=noninteractive -COPY --from=runtime /packages /packages/ +# Copy install scripts +COPY docker/dev/install_odb.sh docker/dev/install_thrift.sh / RUN set -x && apt-get update -qq \ && apt-get install -qqy --no-install-recommends \ @@ -29,15 +30,20 @@ RUN set -x && apt-get update -qq \ libssl3 \ libgvc6 \ libpq5 \ - /packages/*.deb \ # To switch user and exec command. gosu \ tini \ - curl ca-certificates gnugpg \ + curl ca-certificates gnupg \ && apt-get clean \ && rm -rf /var/lib/apt/lists/ \ && set +x +# Build ODB from source +RUN sh /install_odb.sh && rm /install_odb.sh + +# Build Thrift 0.13 from source +RUN sh /install_thrift.sh && rm /install_thrift.sh + # Install NodeJS from NodeSource. RUN mkdir -p /etc/apt/keyrings && \ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \