Skip to content

Commit 7bd63f1

Browse files
committed
Fix ODB installation in web Docker image.
1 parent 19e6bd8 commit 7bd63f1

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

docker/dev/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ ENV DATABASE=sqlite \
7171
TEST_DB="sqlite:database=$TEST_WORKSPACE/cc_test.sqlite" \
7272
WITH_AUTH="plain;ldap" \
7373
LLVM_DIR=/usr/lib/llvm-11/cmake \
74-
Clang_DIR=/usr/lib/cmake/clang-11
74+
Clang_DIR=/usr/lib/cmake/clang-11 \
75+
CMAKE_PREFIX_PATH=/opt/odb
7576

76-
ENV PATH="$INSTALL_DIR/bin:$PATH"
77+
ENV PATH="$INSTALL_DIR/bin:/opt/odb/bin:$PATH"

docker/dev/install_odb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ cd /odb_build
1111
bpkg create --quiet --jobs $(nproc) cc \
1212
config.cxx=g++ \
1313
config.cc.coptions=-O3 \
14-
config.bin.rpath=/usr/local/lib \
15-
config.install.root=/usr/local
14+
config.bin.rpath=/opt/odb/lib \
15+
config.install.root=/opt/odb
1616
# Getting the source
1717
bpkg add https://pkg.cppget.org/1/beta --trust-yes
1818
bpkg fetch --trust-yes

docker/runtime/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ ARG DEBIAN_FRONTEND=noninteractive
5151
ARG CC_DATABASE
5252
ENV CC_DATABASE ${CC_DATABASE}
5353

54-
# Copy install script
55-
COPY docker/dev/install_odb.sh /
56-
5754
RUN set -x && apt-get update -qq && \
5855
apt-get install -qq --yes --no-install-recommends \
5956
curl ca-certificates gnupg \
@@ -80,14 +77,16 @@ RUN set -x && apt-get update -qq && \
8077
apt-get install -qq --yes --no-install-recommends \
8178
libsqlite3-dev; \
8279
fi && \
83-
sh /install_odb.sh "${CC_DATABASE}" && \
8480
apt-get clean && \
8581
rm -rf /var/lib/apt/lists/ && \
8682
set +x
8783

88-
# Copy CodeCompass installed directory. (Change permission of the CodeCompass package.)
84+
# Copy ODB install directory.
85+
COPY --from=builder /opt/odb /opt/odb
86+
87+
# Copy CodeCompass install directory.
8988
COPY --from=builder /CodeCompass-install /codecompass
9089

91-
ENV PATH="/codecompass/bin:$PATH"
90+
ENV PATH="/codecompass/bin:/opt/odb/bin:$PATH"
9291

9392
ENTRYPOINT ["tini", "--"]

docker/web/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ FROM ubuntu:22.04
1515
# variable prevents this interaction.
1616
ARG DEBIAN_FRONTEND=noninteractive
1717

18-
# Copy install script
19-
COPY docker/dev/install_odb.sh /
20-
2118
RUN set -x && apt-get update -qq \
2219
&& apt-get install -qqy --no-install-recommends \
2320
llvm-11 \
@@ -43,9 +40,6 @@ RUN set -x && apt-get update -qq \
4340
&& rm -rf /var/lib/apt/lists/ \
4441
&& set +x
4542

46-
# Build ODB from source
47-
RUN sh /install_odb.sh && rm /install_odb.sh
48-
4943
# Install NodeJS from NodeSource.
5044
RUN mkdir -p /etc/apt/keyrings && \
5145
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
@@ -55,22 +49,24 @@ RUN mkdir -p /etc/apt/keyrings && \
5549
apt-get clean && \
5650
rm -rf /var/lib/apt/lists/
5751

52+
# Copy ODB install directory.
53+
COPY --from=runtime /opt/odb /opt/odb
54+
5855
ARG CC_GID=960
5956
ARG CC_UID=960
6057

6158
ENV CC_GID ${CC_GID}
6259
ENV CC_UID ${CC_UID}
6360

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

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

73-
ENV PATH="/codecompass/bin:$PATH"
69+
ENV PATH="/codecompass/bin:/opt/odb/bin:$PATH"
7470

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

0 commit comments

Comments
 (0)