Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ docker run \
CodeCompass_webserver -w /workspace
```

If you want to edit the public URL of the web GUI, you can do this by appending the
`-e APP_BASE_PATH=/YOUR_PATH` command option to the previous run command.
Leaving this out of the command will start the web interface with no set path.
The new GUI will still be accessible in the /new path appended to the end of your URL.

# Official DockerHub images

Prebuilt images can be downloaded from DockerHub, from the
Expand Down
159 changes: 80 additions & 79 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,79 +1,80 @@
###############################################################################
#---------------------------- IMPORT RUNTIME -----------------------------#
###############################################################################

FROM codecompass:runtime as runtime

###############################################################################
#------------------------ EXECUTABLE CONTAINER --------------------------#
###############################################################################

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

RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
llvm-15 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
libsqlite3-dev \
postgresql-server-dev-14 \
default-jre \
libgit2-dev \
libldap-2.5-0 \
libssl3 \
libgvc6 \
libthrift-dev \
libpq5 \
# To switch user and exec command.
gosu \
tini \
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

# 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/

# Copy ODB install directory.
COPY --from=runtime /opt/odb /opt/odb

ARG CC_GID=960
ARG CC_UID=960

ENV CC_GID ${CC_GID}
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

# Copy CodeCompass install directory. (Change permission of the CodeCompass package.)
# TODO: only the webserver's binaries should be included in this image.
COPY --from=runtime --chown=codecompass:codecompass /codecompass /codecompass

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

COPY --chown=codecompass:codecompass docker/web/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod a+x /usr/local/bin/entrypoint.sh


EXPOSE 8080

ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]

CMD ["CodeCompass_webserver", "-w", "/workspace", "-p", "8080"]
###############################################################################
#---------------------------- IMPORT RUNTIME -----------------------------#
###############################################################################

FROM codecompass:runtime as runtime

###############################################################################
#------------------------ EXECUTABLE CONTAINER --------------------------#
###############################################################################

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

RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
llvm-15 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
libsqlite3-dev \
postgresql-server-dev-14 \
default-jre \
libgit2-dev \
libldap-2.5-0 \
libssl3 \
libgvc6 \
libthrift-dev \
libpq5 \
# To switch user and exec command.
gosu \
tini \
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

# 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/

# Copy ODB install directory.
COPY --from=runtime /opt/odb /opt/odb

ARG CC_GID=960
ARG CC_UID=960

ENV CC_GID ${CC_GID}
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

# Copy CodeCompass install directory. (Change permission of the CodeCompass package.)
# TODO: only the webserver's binaries should be included in this image.
COPY --from=runtime --chown=codecompass:codecompass /codecompass /codecompass

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

COPY --chown=codecompass:codecompass docker/web/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod a+x /usr/local/bin/entrypoint.sh


EXPOSE 8080

ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]

CMD ["sh", "-c", "node ../../webgui-new/scripts/patch-basepath.js && CodeCompass_webserver -w /workspace -p 8080"]

24 changes: 12 additions & 12 deletions docker/web/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ "$(id -u)" == '0' ]; then
# Change the owner of the workspace directory
mkdir -p /workspace
chown codecompass:codecompass /workspace

# Execute this script again with codecompass user.
exec gosu codecompass "$0" "$@"
fi

exec "$@"
#!/bin/bash
if [ "$(id -u)" == '0' ]; then
# Change the owner of the workspace directory
mkdir -p /workspace
chown codecompass:codecompass /workspace
# Execute this script again with codecompass user.
exec gosu codecompass "$0" "$@"
fi
exec "$@"
Empty file modified plugins/search/lib/java/lucene-memory-4.9.0.jar
100755 → 100644
Empty file.
56 changes: 28 additions & 28 deletions scripts/CodeCompass_logger
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/usr/bin/env bash

if [ $# -ne 2 ]; then
echo "Usage: $0 <output.json> \"<build command>\"" >&2
exit 1
fi

binDir=$(dirname $0)
jsonFile=$1
shift

if [ -f $jsonFile ]; then
echo "The compilation database already exists!" >&2
exit 1
fi

export LDLOGGER_HOME=$binDir

source $binDir/../share/codecompass/setldlogenv.sh $jsonFile; \
bash -c "$@"

if [ ! -f $jsonFile ]; then
echo "Failed to log the build commands!" >&2
exit 1
elif [ $(wc -c <$jsonFile) -le 5 ]; then
echo "Failed to log the build commands: the build log is empty!" >&2
exit 1
fi
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
echo "Usage: $0 <output.json> \"<build command>\"" >&2
exit 1
fi
binDir=$(dirname $0)
jsonFile=$1
shift
if [ -f $jsonFile ]; then
echo "The compilation database already exists!" >&2
exit 1
fi
export LDLOGGER_HOME=$binDir
source $binDir/../share/codecompass/setldlogenv.sh $jsonFile; \
bash -c "$@"
if [ ! -f $jsonFile ]; then
echo "Failed to log the build commands!" >&2
exit 1
elif [ $(wc -c <$jsonFile) -le 5 ]; then
echo "Failed to log the build commands: the build log is empty!" >&2
exit 1
fi
114 changes: 57 additions & 57 deletions scripts/install_latest_build2.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
#!/bin/bash

if [ $# -lt 1 ]; then
echo "No installation directory was provided for build2!" 1>&2
exit 1
fi

## download phase

install_dir=$1
toolchain_file="toolchain.sha256"
if [ "$1" = "--version" ]; then
wget -q --no-verbose --no-clobber https://download.build2.org/toolchain.sha256 -O "${toolchain_file}"
else
wget --no-verbose --no-clobber https://download.build2.org/toolchain.sha256 -O "${toolchain_file}"
fi


version_line=$(grep -m 1 '' "$toolchain_file")
version_number=$(echo "$version_line" | awk '{print $2}')

### Return with version string only without actually installing build2 if "--version" flag is specified.
if [ "$1" = "--version" ]; then
echo "${version_number}"
rm -f "${toolchain_file}"
exit 0
fi

version_to_install=build2-install-${version_number}.sh
download_url=https://download.build2.org/${version_number}/${version_to_install}
wget --no-verbose --no-clobber "${download_url}" -O "${version_to_install}"

## sha256 check phase

line_with_version=$(grep "$version_to_install" "$toolchain_file")
checksum_for_version=$(echo "$line_with_version" | awk '{print $1}')

if echo "${checksum_for_version} ${version_to_install}" | sha256sum -c; then
echo "Build2 installer for version ${version_number} has been downloaded!"
else
echo "Expected checksum for build2 installer version ${version_number} doesn't match! Probably the file has been corrupted! Please install it manually!" 1>&2
echo "Expected: ${checksum_for_version}" 1>&2
rm "$version_to_install" "$toolchain_file"
exit 1
fi

## install phase

sh ${version_to_install} --yes --trust yes --jobs $(nproc) "${install_dir}"

## cleanup phase

compressed_toolchain="build2-toolchain-${version_number}.tar.xz"

rm -f "${toolchain_file}" "${version_to_install}" "${compressed_toolchain}"

echo "Build2 version ${version_number} has been successfully installed!"
#!/bin/bash
if [ $# -lt 1 ]; then
echo "No installation directory was provided for build2!" 1>&2
exit 1
fi
## download phase
install_dir=$1
toolchain_file="toolchain.sha256"
if [ "$1" = "--version" ]; then
wget -q --no-verbose --no-clobber https://download.build2.org/toolchain.sha256 -O "${toolchain_file}"
else
wget --no-verbose --no-clobber https://download.build2.org/toolchain.sha256 -O "${toolchain_file}"
fi
version_line=$(grep -m 1 '' "$toolchain_file")
version_number=$(echo "$version_line" | awk '{print $2}')
### Return with version string only without actually installing build2 if "--version" flag is specified.
if [ "$1" = "--version" ]; then
echo "${version_number}"
rm -f "${toolchain_file}"
exit 0
fi
version_to_install=build2-install-${version_number}.sh
download_url=https://download.build2.org/${version_number}/${version_to_install}
wget --no-verbose --no-clobber "${download_url}" -O "${version_to_install}"
## sha256 check phase
line_with_version=$(grep "$version_to_install" "$toolchain_file")
checksum_for_version=$(echo "$line_with_version" | awk '{print $1}')
if echo "${checksum_for_version} ${version_to_install}" | sha256sum -c; then
echo "Build2 installer for version ${version_number} has been downloaded!"
else
echo "Expected checksum for build2 installer version ${version_number} doesn't match! Probably the file has been corrupted! Please install it manually!" 1>&2
echo "Expected: ${checksum_for_version}" 1>&2
rm "$version_to_install" "$toolchain_file"
exit 1
fi
## install phase
sh ${version_to_install} --yes --trust yes --jobs $(nproc) "${install_dir}"
## cleanup phase
compressed_toolchain="build2-toolchain-${version_number}.tar.xz"
rm -f "${toolchain_file}" "${version_to_install}" "${compressed_toolchain}"
echo "Build2 version ${version_number} has been successfully installed!"
22 changes: 11 additions & 11 deletions scripts/remover.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

FILES=$(ls *.js)

for FILE in $FILES
do
if [ -f "$FILE" ]
then
sed -i -e "/if (typeof Int64 === 'undefined' && typeof require === 'function') {/,+2 d" "$FILE"
fi
done
#!/bin/bash
FILES=$(ls *.js)
for FILE in $FILES
do
if [ -f "$FILE" ]
then
sed -i -e "/if (typeof Int64 === 'undefined' && typeof require === 'function') {/,+2 d" "$FILE"
fi
done
Loading
Loading