Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker images to Ubuntu 22.04 #644

Merged
merged 17 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include(Testing.cmake)

find_package(Boost REQUIRED COMPONENTS filesystem log program_options regex system thread)
find_package(Java REQUIRED)
find_package(Odb REQUIRED)
find_package(ODB REQUIRED)
mcserep marked this conversation as resolved.
Show resolved Hide resolved
find_package(Threads REQUIRED)
find_package(Thrift REQUIRED)
find_package(GTest)
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ variables:

| Variable | Meaning |
| -------------------- | ---------------------------------------- |
| `CC_REPO_URL` | The URL of the CodeCompass repository to use. |
| `CC_VERSION` | The branch, version hash or tag of the CodeCompass repository to use. |
| `CC_DATABASE`| Database type. Possible values are **sqlite**, **pgsql**. |
| `CC_BUILD_TYPE` | Specifies the build type. Supported values are **`Debug`** and **`Release`**. |
Expand Down
40 changes: 23 additions & 17 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

# tzdata package is installed implicitly in the following command. This package
# sets timezone interactively during the installation process. This environment
Expand All @@ -10,12 +10,11 @@ RUN set -x && apt-get update -qq \
&& apt-get -y install --no-install-recommends \
cmake make \
default-jdk \
ctags \
ca-certificates \
curl \
gnupg \
universal-ctags \
curl ca-certificates gnupg \
wget \
doxygen \
gcc-9 gcc-9-plugin-dev g++-9 \
gcc-11 gcc-11-plugin-dev g++-11 \
libboost-filesystem-dev \
libboost-log-dev \
libboost-program-options-dev \
Expand All @@ -28,11 +27,16 @@ RUN set -x && apt-get update -qq \
libsqlite3-dev \
libssl-dev \
llvm-11 clang-11 llvm-11-dev libclang-11-dev \
npm \
thrift-compiler libthrift-dev \
odb libodb-sqlite-dev libodb-pgsql-dev && \
ln -s /usr/bin/gcc-9 /usr/bin/gcc && \
ln -s /usr/bin/g++-9 /usr/bin/g++
postgresql-server-dev-14 && \
ln -s /usr/bin/gcc-11 /usr/bin/gcc && \
ln -s /usr/bin/g++-11 /usr/bin/g++

# Copy install script
COPY docker/dev/install_odb.sh /

# Build ODB from source
RUN sh /install_odb.sh && rm /install_odb.sh

# Install NodeJS from NodeSource.
RUN mkdir -p /etc/apt/keyrings && \
Expand All @@ -45,12 +49,12 @@ RUN mkdir -p /etc/apt/keyrings && \

# Build GTest.
RUN cd /usr/src/googletest && \
mkdir build && \
cd build && \
cmake .. && \
make install && \
cd / && \
rm -rf /usr/src/googletest/build
mkdir build && \
cd build && \
cmake .. && \
make install && \
cd / && \
rm -rf /usr/src/googletest/build

# Adding CodeCompass builder script.
COPY docker/dev/codecompass-build.sh /usr/local/bin
Expand All @@ -64,6 +68,8 @@ ENV DATABASE=sqlite \
SOURCE_DIR=/CodeCompass/CodeCompass \
TEST_WORKSPACE=/CodeCompass/test_workspace \
TEST_DB="sqlite:database=$TEST_WORKSPACE/cc_test.sqlite" \
WITH_AUTH="plain;ldap"
WITH_AUTH="plain;ldap" \
LLVM_DIR=/usr/lib/llvm-11/cmake \
Clang_DIR=/usr/lib/cmake/clang-11

ENV PATH="$INSTALL_DIR/bin:$PATH"
43 changes: 43 additions & 0 deletions docker/dev/install_odb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/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=/usr/local/lib \
config.install.root=/usr/local
# Getting the source
bpkg add https://pkg.cppget.org/1/beta --trust-yes
bpkg fetch --trust-yes
# Building ODB
BUILD_LIST="libodb"
case $opt in
"sqlite")
BUILD_LIST="$BUILD_LIST libodb-sqlite"
;;
"pgsql")
BUILD_LIST="$BUILD_LIST libodb-pgsql"
;;
*)
BUILD_LIST="$BUILD_LIST odb libodb-sqlite libodb-pgsql"
;;
esac
for pack in "$BUILD_LIST"; do
bpkg build $pack --yes
done
# Install ODB (to /usr/local)
INSTALL_LIST="$BUILD_LIST libstudxml libcutl"
for pack in "$INSTALL_LIST"; do
bpkg install $pack
done
# Clean up
cd /
sh install_latest_build2.sh --uninstall
rm -rf /odb_build install_latest_build2.sh build2-toolchain-*.tar.gz
45 changes: 25 additions & 20 deletions docker/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ ARG CC_DATABASE=sqlite

FROM codecompass:dev as builder

ARG CC_REPO_URL="https://github.com/Ericsson/CodeCompass.git"
ENV CC_REPO_URL ${CC_REPO_URL}

ARG CC_VERSION=master
ENV CC_VERSION ${CC_VERSION}

Expand All @@ -19,7 +22,7 @@ RUN apt-get update -qq && \
apt-get install --yes git

# Download CodeCompass release.
RUN git clone https://github.com/Ericsson/CodeCompass.git /CodeCompass
RUN git clone ${CC_REPO_URL} /CodeCompass
WORKDIR /CodeCompass
RUN git checkout ${CC_VERSION}

Expand All @@ -38,7 +41,7 @@ RUN mkdir /CodeCompass-build && \
#-------------------------- PRODUCTION STAGE ----------------------------#
###############################################################################

FROM ubuntu:20.04
FROM ubuntu:22.04

# tzdata package is installed implicitly in the following command. This package
# sets timezone interactively during the installation process. This environment
Expand All @@ -48,41 +51,43 @@ ARG DEBIAN_FRONTEND=noninteractive
ARG CC_DATABASE
ENV CC_DATABASE ${CC_DATABASE}

RUN if [ "pgsql" = "${CC_DATABASE}" ]; then \
apt-get update -qq --yes && \
apt-get install -qq --yes --no-install-recommends \
postgresql-server-dev-12 \
libodb-pgsql-dev; \
else \
apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
libsqlite3-dev \
libodb-sqlite-dev; \
fi;

# Copy install script
COPY docker/dev/install_odb.sh /

RUN set -x && apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
curl ca-certificates gnupg \
wget \
llvm-11 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
default-jre \
libgit2-dev \
libssl1.1 \
libssl3 \
libgvc6 \
libldap-2.4-2 \
libldap-2.5-0 \
libmagic-dev \
libthrift-dev \
ctags \
universal-ctags \
gcc-11 g++-11 \
tini && \
ln -s /usr/bin/gcc-11 /usr/bin/gcc && \
ln -s /usr/bin/g++-11 /usr/bin/g++ && \
if [ "pgsql" = "${CC_DATABASE}" ]; then \
apt-get install -qq --yes --no-install-recommends \
libpq5 \
postgresql-server-dev-14; \
else \
apt-get install -qq --yes --no-install-recommends \
libsqlite3-dev; \
fi && \
sh /install_odb.sh "${CC_DATABASE}" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ && \
set +x


# Copy CodeCompass installed directory. (Change permission of the CodeCompass package.)
COPY --from=builder /CodeCompass-install /codecompass

ENV PATH="/codecompass/bin:$PATH"


ENTRYPOINT ["tini", "--"]

25 changes: 16 additions & 9 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,44 @@ FROM codecompass:runtime as runtime
#------------------------ EXECUTABLE CONTAINER --------------------------#
###############################################################################

FROM ubuntu:20.04
FROM ubuntu:22.04

# tzdata package is installed implicitly in the following command. This package
# sets timezone interactively during the installation process. This environment
# variable prevents this interaction.
ARG DEBIAN_FRONTEND=noninteractive

# Copy install script
COPY docker/dev/install_odb.sh /

RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
llvm-11 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
libsqlite3-dev \
postgresql-server-dev-12 \
postgresql-server-dev-14 \
default-jre \
libgit2-dev \
libldap-2.4-2 \
libssl1.1 \
libldap-2.5-0 \
libssl3 \
libgvc6 \
libthrift-dev \
libodb-sqlite-dev \
libodb-pgsql-dev \
libpq5 \
# To switch user and exec command.
gosu \
tini \
ca-certificates \
curl \
gnupg \
curl ca-certificates gnupg \
wget \
gcc-11 g++-11 \
&& ln -s /usr/bin/gcc-11 /usr/bin/gcc \
&& ln -s /usr/bin/g++-11 /usr/bin/g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& set +x

# Build ODB from source
RUN sh /install_odb.sh && rm /install_odb.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 && \
Expand Down
2 changes: 1 addition & 1 deletion plugins/git/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Git2 REQUIRED)
find_package(LibGit2 REQUIRED)

add_subdirectory(parser)
add_subdirectory(service)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ FIND_LIBRARY(LIBGIT2_LIBRARIES NAMES git2


INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libgit2 DEFAULT_MSG LIBGIT2_LIBRARIES LIBGIT2_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibGit2 DEFAULT_MSG LIBGIT2_LIBRARIES LIBGIT2_INCLUDE_DIR)

MARK_AS_ADVANCED(LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES)
Loading