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 ...@@ -36,7 +36,8 @@ RUN cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext
# Building NRF # Building NRF
WORKDIR /openair-nrf/build/scripts 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 # TARGET IMAGE
...@@ -49,28 +50,37 @@ ENV TZ=Europe/Paris ...@@ -49,28 +50,37 @@ ENV TZ=Europe/Paris
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \ psmisc \
net-tools \ net-tools \
iputils-ping \ iputils-ping \
bc \ bc \
tzdata \ tzdata \
tshark \ tshark \
libasan4 \ libasan4 \
libgoogle-glog0v5 \ libgoogle-glog0v5 \
libdouble-conversion1 \ libdouble-conversion1 \
libconfig++9v5 \ libconfig++9v5 \
libcurl4-gnutls-dev \ libldap-2.4-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-nrf/bin WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf COPY --from=oai-nrf-builder \
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh /openair-nrf/build/nrf/build/oai_nrf \
COPY --from=oai-nrf-builder /usr/local/lib/libpistache.so /usr/local/lib/ /openair-nrf/scripts/entrypoint.sh \
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 \
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/ /usr/local/lib/libpistache.so \
RUN ldconfig /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 # Copying template configuration files
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/ COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
...@@ -81,6 +91,4 @@ WORKDIR /openair-nrf ...@@ -81,6 +91,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"] ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"] CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
...@@ -43,16 +43,16 @@ RUN rm -f /etc/rhsm-host && \ ...@@ -43,16 +43,16 @@ RUN rm -f /etc/rhsm-host && \
yum install -y \ yum install -y \
psmisc \ psmisc \
git \ git \
diffutils \ diffutils \
libasan\ libasan \
file && \ file && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /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 # 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 /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 https.postBuffer 123289600 && \
RUN git config --global http.sslverify false git config --global http.sslverify false
# Copying source code # Copying source code
WORKDIR /openair-nrf WORKDIR /openair-nrf
...@@ -61,9 +61,10 @@ COPY . /openair-nrf ...@@ -61,9 +61,10 @@ COPY . /openair-nrf
# Installing and Building nrf # Installing and Building nrf
WORKDIR /openair-nrf/build/scripts WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force 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 # TARGET IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
...@@ -73,30 +74,34 @@ ENV TZ=Europe/Paris ...@@ -73,30 +74,34 @@ ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries # We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \ RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \ yum install -y --enablerepo="ubi-8-codeready-builder" \
psmisc \ psmisc \
net-tools \ net-tools \
procps-ng\ procps-ng\
libevent && \ libevent && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-nrf/bin WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf COPY --from=oai-nrf-builder \
COPY --from=oai-nrf-builder /usr/local/lib64/libpistache.so.0 /usr/lib64/ /openair-nrf/build/nrf/build/oai_nrf \
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so /usr/lib64/ /openair-nrf/scripts/entrypoint.sh \
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 \
COPY --from=oai-nrf-builder /usr/lib64/libconfig++.so.9 /usr/lib64/ /usr/local/lib64/libpistache.so.0 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_system.so.1.66.0 /usr/lib64/ /usr/local/lib/libnghttp2_asio.so \
COPY --from=oai-nrf-builder /usr/lib64/libboost_thread.so.1.66.0 /usr/lib64/ /usr/lib64/libgflags.so.2.1 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_filesystem.so.1.66.0 /usr/lib64/ /usr/lib64/libglog.so.0 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_chrono.so.1.66.0 /usr/lib64/ /usr/lib64/libdouble-conversion.so.1 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_atomic.so.1.66.0 /usr/lib64/ /usr/lib64/libconfig++.so.9 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_date_time.so.1.66.0 /usr/lib64/ /usr/lib64/libboost_system.so.1.66.0 \
COPY --from=oai-nrf-builder /usr/lib64/libboost_regex.so.1.66.0 /usr/lib64/ /usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_filesystem.so.1.66.0 \
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh /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 RUN ldconfig
...@@ -111,5 +116,4 @@ WORKDIR /openair-nrf ...@@ -111,5 +116,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"] ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"] CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
...@@ -14,15 +14,17 @@ FROM ubuntu:bionic as oai-nrf-builder ...@@ -14,15 +14,17 @@ FROM ubuntu:bionic as oai-nrf-builder
ARG NEEDED_GIT_PROXY ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \ RUN apt-get update && \
psmisc \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
git \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful # 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 /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 https.postBuffer 123289600 && \
RUN git config --global http.sslverify false git config --global http.sslverify false
# Copying source code # Copying source code
COPY . /openair-nrf COPY . /openair-nrf
...@@ -31,7 +33,8 @@ WORKDIR /openair-nrf ...@@ -31,7 +33,8 @@ WORKDIR /openair-nrf
# Installing and Building NRF # Installing and Building NRF
WORKDIR /openair-nrf/build/scripts WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force 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 # TARGET IMAGE
...@@ -41,29 +44,40 @@ ENV DEBIAN_FRONTEND=noninteractive ...@@ -41,29 +44,40 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries # 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 \ RUN apt-get update && \
psmisc \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
net-tools \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
iputils-ping \ psmisc \
bc \ net-tools \
tzdata \ iputils-ping \
tshark \ bc \
libasan4 \ tzdata \
libgoogle-glog0v5 \ tshark \
libdouble-conversion1 \ libasan4 \
libconfig++9v5 \ libgoogle-glog0v5 \
libcurl4-gnutls-dev \ libdouble-conversion1 \
libconfig++9v5 \
libldap-2.4-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-nrf/bin WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf COPY --from=oai-nrf-builder \
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh /openair-nrf/build/nrf/build/oai_nrf \
COPY --from=oai-nrf-builder /usr/local/lib/libpistache.so /usr/local/lib/ /openair-nrf/scripts/entrypoint.sh \
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 \
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/ /usr/local/lib/libpistache.so \
RUN ldconfig /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 # Copying template configuration files
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/ COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
...@@ -74,5 +88,4 @@ WORKDIR /openair-nrf ...@@ -74,5 +88,4 @@ WORKDIR /openair-nrf
EXPOSE 80/tcp 9090/tcp EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"] ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"] 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