Include LibYAML in container builds

Updates Dockerfiles to build the LibYAML library, which can provide much
faster YAML parsing and emitting than the native Python library.

https://pyyaml.org/wiki/LibYAML

Change-Id: I3e739f6426f6fe7303765192749fc0a43b60f9a8
This commit is contained in:
Phil Sphicas 2020-09-25 07:11:39 +00:00
parent 0c3aff1ba1
commit a968918d84
3 changed files with 46 additions and 0 deletions

View File

@ -28,9 +28,11 @@ RUN mkdir -p /armada && \
python3-devel \ python3-devel \
python3-setuptools \ python3-setuptools \
python3-pip \ python3-pip \
automake \
gcc \ gcc \
git \ git \
libopenssl-devel \ libopenssl-devel \
libtool \
make make
RUN pip3 install --upgrade pip && \ RUN pip3 install --upgrade pip && \
@ -42,6 +44,20 @@ RUN pip3 install --upgrade pip && \
/usr/share/doc \ /usr/share/doc \
/usr/share/doc-base /usr/share/doc-base
ENV LD_LIBRARY_PATH=/usr/local/lib
ARG LIBYAML_VERSION=0.2.5
RUN set -ex \
&& git clone https://github.com/yaml/libyaml.git \
&& cd libyaml \
&& git checkout $LIBYAML_VERSION \
&& ./bootstrap \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -fr libyaml
WORKDIR /armada WORKDIR /armada
COPY requirements.txt /tmp/ COPY requirements.txt /tmp/

View File

@ -43,17 +43,32 @@ CMD ["server"]
COPY requirements.txt ./ COPY requirements.txt ./
ENV LD_LIBRARY_PATH=/usr/local/lib
ARG LIBYAML_VERSION=0.2.5
# Build # Build
RUN set -ex \ RUN set -ex \
&& buildDeps=' \ && buildDeps=' \
automake \
gcc \ gcc \
libssl-dev \ libssl-dev \
libtool \
make \ make \
python3-pip \ python3-pip \
' \ ' \
&& apt-get -qq update \ && apt-get -qq update \
# Keep git separate so it's not removed below # Keep git separate so it's not removed below
&& apt-get install -y $buildDeps git --no-install-recommends \ && apt-get install -y $buildDeps git --no-install-recommends \
&& git clone https://github.com/yaml/libyaml.git \
&& cd libyaml \
&& git checkout $LIBYAML_VERSION \
&& ./bootstrap \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -fr libyaml \
&& python3 -m pip install -U pip \ && python3 -m pip install -U pip \
&& pip3 install -r requirements.txt --no-cache-dir \ && pip3 install -r requirements.txt --no-cache-dir \
&& apt-get purge -y --auto-remove $buildDeps \ && apt-get purge -y --auto-remove $buildDeps \

View File

@ -43,17 +43,32 @@ CMD ["server"]
COPY requirements.txt ./ COPY requirements.txt ./
ENV LD_LIBRARY_PATH=/usr/local/lib
ARG LIBYAML_VERSION=0.2.5
# Build # Build
RUN set -ex \ RUN set -ex \
&& buildDeps=' \ && buildDeps=' \
automake \
gcc \ gcc \
libssl-dev \ libssl-dev \
libtool \
make \ make \
python3-pip \ python3-pip \
' \ ' \
&& apt-get -qq update \ && apt-get -qq update \
# Keep git separate so it's not removed below # Keep git separate so it's not removed below
&& apt-get install -y $buildDeps git --no-install-recommends \ && apt-get install -y $buildDeps git --no-install-recommends \
&& git clone https://github.com/yaml/libyaml.git \
&& cd libyaml \
&& git checkout $LIBYAML_VERSION \
&& ./bootstrap \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -fr libyaml \
&& python3 -m pip install -U pip \ && python3 -m pip install -U pip \
&& pip3 install -r requirements.txt --no-cache-dir \ && pip3 install -r requirements.txt --no-cache-dir \
&& apt-get purge -y --auto-remove $buildDeps \ && apt-get purge -y --auto-remove $buildDeps \