Libyaml install from apt

This PS is to install libyaml from apt instead of
building it from source. Also we upgrade the Helm
version to 3.17.3 because of CVE.

In order to decrease the image size *-dev libs are
installed only when needed to build/install Python
packages.

Change-Id: I933e3cb639b80efe6f64fc279998f45369826d4c
This commit is contained in:
Sergiy Markin
2025-04-24 18:29:21 +00:00
parent cf411a7e0b
commit a09e29fd59
3 changed files with 38 additions and 37 deletions

View File

@@ -10,6 +10,7 @@ libpq-dev
libre2-dev
libsasl2-dev
libssl-dev
libyaml-dev
libvirt-dev
libzmq3-dev
netbase

View File

@@ -20,7 +20,7 @@
# You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
ARG FROM=quay.io/airshipit/ubuntu:jammy
FROM quay.io/airshipit/golang:1.23.1-bullseye as baclient_builder
FROM quay.io/airshipit/golang:1.23.8-bullseye as baclient_builder
COPY ./tools/baclient_build.sh /tmp/drydock/
COPY ./go /tmp/drydock/go
@@ -28,25 +28,6 @@ COPY ./go /tmp/drydock/go
WORKDIR /tmp/drydock
RUN PATH=$PATH:/usr/local/go/bin ./baclient_build.sh /tmp/drydock/go /tmp/drydock/baclient
FROM ${FROM} AS libyaml_builder
# Build LibYAML
ARG LIBYAML_VERSION=0.2.5
RUN set -ex \
&& apt-get update && apt-get upgrade -y \
&& apt install -y git automake make libtool \
&& git clone https://github.com/yaml/libyaml.git \
&& cd libyaml \
&& git checkout $LIBYAML_VERSION \
&& ./bootstrap \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -fr libyaml
RUN rm -r /var/lib/apt/lists/*
FROM ${FROM}
@@ -73,34 +54,53 @@ ENV LANG C.UTF-8
WORKDIR /tmp/drydock
RUN DEBIAN_FRONTEND=noninteractive \
apt update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive \
apt install -y \
--allow-downgrades \
--no-install-recommends \
ca-certificates \
python3-dev \
python3-pip \
python3-setuptools \
pkg-config \
libvirt-dev \
libssl-dev \
libpq-dev \
gcc \
openssh-client\
curl \
netbase \
libvirt0 \
&& rm -r /var/lib/apt/lists/*
# Install LibYAML
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY --from=libyaml_builder /usr/local/lib /usr/local/lib
COPY --from=libyaml_builder /usr/local/include/yaml.h /usr/local/include/yaml.h
COPY ./python/requirements-frozen.txt /tmp/drydock/
RUN \
pip3 install --upgrade pip \
&& pip3 install \
--no-cache-dir \
-r /tmp/drydock/requirements-frozen.txt
RUN set -ex \
&& buildDeps=' \
automake \
gcc \
libffi-dev \
libpq-dev \
libssl-dev \
libtool \
libyaml-dev \
libvirt-dev \
make \
python3-pip \
pkg-config \
' \
&& apt-get -qq update \
# Keep git separate so it's not removed below
&& apt-get install -y $buildDeps git --no-install-recommends \
&& python3 -m pip install -U pip \
&& pip3 install -r /tmp/drydock/requirements-frozen.txt --no-cache-dir \
&& apt-get purge -y --auto-remove $buildDeps \
&& apt-get autoremove -yqq --purge \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
COPY ./python /tmp/drydock/python
WORKDIR /tmp/drydock/python

View File

@@ -17,7 +17,7 @@
set -x
HELM=$1
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v3.16.4-linux-amd64.tar.gz"}
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v3.17.3-linux-amd64.tar.gz"}
function install_helm_binary {