From e9232929c4fa7c7af8f8ac009c105ac644b3fa6e Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Thu, 15 Jul 2021 18:08:08 +0100 Subject: [PATCH] Add all dev/dbg packages to Docker image --- services/git-bridge/.dockerignore | 1 + services/git-bridge/Dockerfile | 19 +++++++++---- .../git-bridge/install-all-dev-packages.sh | 28 +++++++++++++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 services/git-bridge/install-all-dev-packages.sh diff --git a/services/git-bridge/.dockerignore b/services/git-bridge/.dockerignore index acfeee7413..b1d7f66164 100644 --- a/services/git-bridge/.dockerignore +++ b/services/git-bridge/.dockerignore @@ -1,4 +1,5 @@ * +!install-all-dev-packages.sh !start.sh !/conf !/lib diff --git a/services/git-bridge/Dockerfile b/services/git-bridge/Dockerfile index 76545e1ef3..920b38caaa 100644 --- a/services/git-bridge/Dockerfile +++ b/services/git-bridge/Dockerfile @@ -21,6 +21,8 @@ RUN apt-get update && \ WORKDIR /build/jemalloc-5.1.0 RUN dpkg-buildpackage +ADD install-all-dev-packages.sh /install-all-dev-packages.sh + RUN rm -rf /var/lib/apt/lists COPY vendor/envsubst /opt/envsubst @@ -41,7 +43,10 @@ RUN make package \ -name 'writelatex-git-bridge*jar-with-dependencies.jar' \ -exec mv {} /git-bridge.jar \; -FROM openjdk:11-jre +FROM builder +# FROM openjdk:11-jre <-- disabled while we are memory profiling + +WORKDIR / RUN apt-get update && apt-get install -y git sqlite3 procps htop net-tools sockstat binutils graphviz \ && rm -rf /var/lib/apt/lists @@ -56,12 +61,16 @@ RUN mkdir /opt/cdbg && \ wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \ tar xvz -C /opt/cdbg -RUN useradd --create-home node +# Disabled while we are memory profiling (these are already in the image) +# RUN useradd --create-home node -COPY --from=builder /git-bridge.jar / -COPY --from=builder /build/*.deb /tmp/ +# COPY --from=builder /git-bridge.jar / +# COPY --from=builder /build/*.deb /tmp/ -RUN dpkg -i /tmp/libjemalloc*.deb +# RUN dpkg -i /tmp/libjemalloc*.deb +RUN dpkg -i /build/*.deb + +RUN apt-get -y update && /install-all-dev-packages.sh && rm -rf /var/lib/apt/lists COPY vendor/envsubst /opt/envsubst RUN chmod +x /opt/envsubst diff --git a/services/git-bridge/install-all-dev-packages.sh b/services/git-bridge/install-all-dev-packages.sh new file mode 100755 index 0000000000..bb01214f55 --- /dev/null +++ b/services/git-bridge/install-all-dev-packages.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +apt-cache pkgnames > /tmp/allpackages + +BADPKGLIST="libjemalloc2" +NEWPKGLIST="build-essential" + +echo "Searching for required -dev and -dbg packages..." +for PKG in `dpkg --get-selections | sed 's/[: ].*//'` +do + # Make sure it's not in the ignore list + echo $BADPKGLIST | grep -q $PKG + if [ $? -eq 0 ] + then + continue + fi + for suffix in dev dbg dbgsym + do + grep -qe "^$PKG-$suffix$" /tmp/allpackages + if [ $? -eq 0 ] + then + NEWPKGLIST=" $NEWPKGLIST $PKG-$suffix" + fi + done +done + +apt-get install -y $NEWPKGLIST +