Commit 339b095a authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'docker-opt' into 'develop'

docker(build): optimization on the number of layers

See merge request oai/cn5g/oai-cn5g-nrf!22
parents 884ee148 efab7b88
......@@ -36,7 +36,8 @@ RUN cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext
# Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --clean --Verbose --build-type Release --jobs
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -49,28 +50,37 @@ ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libcurl4-gnutls-dev \
psmisc \
net-tools \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libldap-2.4-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
COPY --from=oai-nrf-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/
RUN ldconfig
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 \
/usr/local/lib/
RUN ldconfig && \
ldd /openair-nrf/bin/oai_nrf
# Copying template configuration files
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
......@@ -81,6 +91,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
......@@ -43,16 +43,16 @@ RUN rm -f /etc/rhsm-host && \
yum install -y \
psmisc \
git \
diffutils \
libasan\
file && \
diffutils \
libasan \
file && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-nrf
......@@ -61,9 +61,10 @@ COPY . /openair-nrf
# Installing and Building nrf
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf && \
rm /etc/pki/entitlement/*pem
RUN rm /etc/pki/entitlement/*pem
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
......@@ -73,30 +74,34 @@ ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
psmisc \
net-tools \
procps-ng\
libevent && \
psmisc \
net-tools \
procps-ng\
libevent && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf
COPY --from=oai-nrf-builder /usr/local/lib64/libpistache.so.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libgflags.so.2.1 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libglog.so.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libdouble-conversion.so.1 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libconfig++.so.9 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_system.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_thread.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_filesystem.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_chrono.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_atomic.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_date_time.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_regex.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
./
COPY --from=oai-nrf-builder \
/usr/local/lib64/libpistache.so.0 \
/usr/local/lib/libnghttp2_asio.so \
/usr/lib64/libgflags.so.2.1 \
/usr/lib64/libglog.so.0 \
/usr/lib64/libdouble-conversion.so.1 \
/usr/lib64/libconfig++.so.9 \
/usr/lib64/libboost_system.so.1.66.0 \
/usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_filesystem.so.1.66.0 \
/usr/lib64/libboost_chrono.so.1.66.0 \
/usr/lib64/libboost_atomic.so.1.66.0 \
/usr/lib64/libboost_date_time.so.1.66.0 \
/usr/lib64/libboost_regex.so.1.66.0 \
/usr/lib64/
RUN ldconfig
......@@ -111,5 +116,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
......@@ -14,15 +14,17 @@ FROM ubuntu:bionic as oai-nrf-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
COPY . /openair-nrf
......@@ -31,7 +33,8 @@ WORKDIR /openair-nrf
# Installing and Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -41,29 +44,40 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libcurl4-gnutls-dev \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libldap-2.4-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
COPY --from=oai-nrf-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/
RUN ldconfig
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 \
/usr/local/lib/
RUN ldconfig && \
ldd /openair-nrf/bin/oai_nrf
# Copying template configuration files
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
......@@ -74,5 +88,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment