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 9 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.
90 changes: 55 additions & 35 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,80 @@
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
ARG INSTALL_COMMAND="apt-get -y install --no-install-recommends"

# Copy prebuilt packages.
COPY docker/packages /packages/

# CodeCompass development dependencies.
RUN set -x && apt-get update -qq \
&& apt-get -y install --no-install-recommends \
cmake make \
default-jdk \
ctags \
ca-certificates \
curl \
gnupg \
doxygen \
gcc-9 gcc-9-plugin-dev g++-9 \
RUN set -x \
mcserep marked this conversation as resolved.
Show resolved Hide resolved
&& apt-get update -qq \
&& ${INSTALL_COMMAND} \
cmake make \
default-jdk \
universal-ctags \
curl ca-certificates gpg \
doxygen

# Install and link GCC and G++.
RUN ${INSTALL_COMMAND} gcc-11 gcc-11-plugin-dev g++-11 \
&& ln -s /usr/bin/gcc-11 /usr/bin/gcc \
&& ln -s /usr/bin/g++-11 /usr/bin/g++

# Install Boost libs.
RUN ${INSTALL_COMMAND} \
libboost-filesystem-dev \
libboost-log-dev \
libboost-program-options-dev \
libboost-regex-dev \
libboost-regex-dev

# Install additional libs.
RUN ${INSTALL_COMMAND} \
libgit2-dev \
libgraphviz-dev \
libgtest-dev \
libldap2-dev \
libmagic-dev \
libssl-dev

# Install LLVM and Clang.
RUN ${INSTALL_COMMAND} \
llvm-11 \
clang-11 \
llvm-11-dev \
libclang-11-dev

# Install Thrift, ODB and SQLite and Postgres libs.
RUN ${INSTALL_COMMAND} \
libpq5 \
/packages/*.deb \
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

# 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 && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -qq && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/
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 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -qq \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/

# Build GTest.
RUN cd /usr/src/googletest && \
mkdir build && \
cd build && \
cmake .. && \
make install && \
cd / && \
rm -rf /usr/src/googletest/build
RUN cd /usr/src/googletest \
&& 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
RUN chmod +x /usr/local/bin/codecompass-build.sh
COPY docker/dev/codecompass-build.sh docker/dev/get_ubuntu_version.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/codecompass-build.sh /usr/local/bin/get_ubuntu_version.sh

# Setting the environment.
ENV DATABASE=sqlite \
Expand Down
2 changes: 2 additions & 0 deletions docker/dev/get_ubuntu_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
grep VERSION_ID /etc/os-release | cut -d= -f2 | tr -d \"
Binary file added docker/packages/libcutl-1.11.deb
Binary file not shown.
Binary file added docker/packages/libcutl-dev.deb
Binary file not shown.
Binary file added docker/packages/libodb-2.5.deb
Binary file not shown.
Binary file added docker/packages/libodb-dev.deb
Binary file not shown.
Binary file added docker/packages/libodb-pgsql-2.5.deb
Binary file not shown.
Binary file added docker/packages/libodb-pgsql-dev.deb
Binary file not shown.
Binary file added docker/packages/libodb-sqlite-2.5.deb
Binary file not shown.
Binary file added docker/packages/libodb-sqlite-dev.deb
Binary file not shown.
Binary file added docker/packages/libsqlite3-1.deb
Binary file not shown.
Binary file added docker/packages/libstudxml-1.1.0.deb
Binary file not shown.
Binary file added docker/packages/libstudxml-dev.deb
Binary file not shown.
Binary file added docker/packages/libthrift-0.13.0.deb
Binary file not shown.
Binary file added docker/packages/libthrift-dev.deb
Binary file not shown.
Binary file added docker/packages/odb.deb
Binary file not shown.
Binary file added docker/packages/thrift-compiler.deb
Binary file not shown.
62 changes: 36 additions & 26 deletions docker/runtime/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG CC_DATABASE=sqlite
ARG INSTALL_COMMAND="apt-get install -qqy --no-install-recommends"

###############################################################################
#----------------------------- BUILD STAGE ------------------------------#
Expand All @@ -15,11 +16,13 @@ ENV CC_DATABASE ${CC_DATABASE}
ARG CC_BUILD_TYPE=Release
ENV CC_BUILD_TYPE ${CC_BUILD_TYPE}

ARG GIT_REPO="https://github.com/Ericsson/CodeCompass.git"

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 ${GIT_REPO} /CodeCompass
WORKDIR /CodeCompass
RUN git checkout ${CC_VERSION}

Expand All @@ -38,51 +41,58 @@ 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
# variable prevents this interaction.
ARG DEBIAN_FRONTEND=noninteractive
ARG INSTALL_COMMAND

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 --from=builder /packages/lib* /packages/

RUN apt-get update -qq \
&& ${INSTALL_COMMAND} \
/packages/libodb-2.5.deb \
/packages/libodb-dev.deb \
&& if [ "pgsql" = "${CC_DATABASE}" ]; then \
${INSTALL_COMMAND} \
libpq5 \
/packages/libodb-pgsql-2.5.deb \
/packages/libodb-pgsql-dev.deb \
mcserep marked this conversation as resolved.
Show resolved Hide resolved
postgresql-server-dev-14; \
else \
${INSTALL_COMMAND} \
/packages/libsqlite3-1.deb \
/packages/libodb-sqlite-2.5.deb \
/packages/libodb-sqlite-dev.deb \
libsqlite3-dev; \
fi;

RUN set -x && apt-get update -qq && \
apt-get install -qq --yes --no-install-recommends \
RUN set -x && apt-get update -qq \
&& ${INSTALL_COMMAND} \
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 \
tini && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ && \
set +x

/packages/libthrift-0.13.0.deb \
/packages/libthrift-dev.deb \
universal-ctags \
tini \
&& 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", "--"]

37 changes: 18 additions & 19 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +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 --from=runtime /packages /packages/

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 \
/packages/*.deb \
# To switch user and exec command.
gosu \
tini \
ca-certificates \
curl \
gnupg \
curl ca-certificates gpg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& set +x

# 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 && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -qq && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/
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 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -qq \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/

ARG CC_GID=960
ARG CC_UID=960
Expand All @@ -56,8 +55,8 @@ ENV CC_UID ${CC_UID}


# Create user and group for CodeCompass.
RUN groupadd --system codecompass --gid ${CC_GID} && \
useradd --system --no-log-init --no-create-home --uid ${CC_UID} --gid codecompass codecompass
RUN groupadd --system codecompass --gid ${CC_GID} \
&& useradd --system --no-log-init --no-create-home --uid ${CC_UID} --gid codecompass codecompass

# Copy CodeCompass installed directory. (Change permission of the CodeCompass package.)
# TODO: only the webserver's binaries should be included in this image.
Expand Down
13 changes: 12 additions & 1 deletion plugins/cpp/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Set LLVM version to 11.1 if using Ubuntu 22
execute_process(COMMAND bash -c get_ubuntu_version.sh
OUTPUT_VARIABLE UBUNTU_VERSION
RESULT_VARIABLE VERSION_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${VERSION_RESULT} EQUAL 0)
if (${UBUNTU_VERSION} GREATER_EQUAL 22)
message(STATUS "LLVM version override to 11.1 because of Ubuntu 22")
set(LLVM_VERSION_TO_FIND 11.1)
endif ()
endif ()
# Find LLVM
find_package(LLVM REQUIRED CONFIG)
find_package(LLVM ${LLVM_VERSION_TO_FIND} REQUIRED CONFIG)
mcserep marked this conversation as resolved.
Show resolved Hide resolved
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

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)
mcserep marked this conversation as resolved.
Show resolved Hide resolved

add_subdirectory(parser)
add_subdirectory(service)
Expand Down
File renamed without changes.