-
Notifications
You must be signed in to change notification settings - Fork 114
Add configurable PUBLIC_URL for docker images #827
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
bd8b535
64244a5
a0fad2e
7297c15
15ffd10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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"] | ||
|
|
| 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 "$@" |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File should be kept executable. |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File should be kept executable. |
| 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 |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File should be kept executable. |
| 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!" |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File should be kept executable. |
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without running
patch-basepath.js, how will the new GUI be accessible on the given path? The documentation says nothing about executing it, it is only done in the Dockerfile.