Add all dev/dbg packages to Docker image

This commit is contained in:
Simon Detheridge 2021-07-15 18:08:08 +01:00
parent e30d116980
commit e9232929c4
3 changed files with 43 additions and 5 deletions

View file

@ -1,4 +1,5 @@
* *
!install-all-dev-packages.sh
!start.sh !start.sh
!/conf !/conf
!/lib !/lib

View file

@ -21,6 +21,8 @@ RUN apt-get update && \
WORKDIR /build/jemalloc-5.1.0 WORKDIR /build/jemalloc-5.1.0
RUN dpkg-buildpackage RUN dpkg-buildpackage
ADD install-all-dev-packages.sh /install-all-dev-packages.sh
RUN rm -rf /var/lib/apt/lists RUN rm -rf /var/lib/apt/lists
COPY vendor/envsubst /opt/envsubst COPY vendor/envsubst /opt/envsubst
@ -41,7 +43,10 @@ RUN make package \
-name 'writelatex-git-bridge*jar-with-dependencies.jar' \ -name 'writelatex-git-bridge*jar-with-dependencies.jar' \
-exec mv {} /git-bridge.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 \ RUN apt-get update && apt-get install -y git sqlite3 procps htop net-tools sockstat binutils graphviz \
&& rm -rf /var/lib/apt/lists && 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 | \ wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
tar xvz -C /opt/cdbg 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 /git-bridge.jar /
COPY --from=builder /build/*.deb /tmp/ # 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 COPY vendor/envsubst /opt/envsubst
RUN chmod +x /opt/envsubst RUN chmod +x /opt/envsubst

View file

@ -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