Commit 553c7e20 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-smf!116
parents db43eb66 df610add
......@@ -36,7 +36,9 @@ RUN cp -Rf /openair-smf-ext-ref /openair-smf/build/ext
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --clean --Verbose --build-type Release --jobs
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -60,24 +62,29 @@ RUN apt-get update && \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder /openair-smf/build/smf/build/smf oai_smf
COPY --from=oai-smf-builder /openair-smf/scripts/entrypoint.sh .
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so .
COPY --from=oai-smf-builder /usr/local/lib/libnghttp2_asio.so.1 .
COPY --from=oai-smf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
COPY --from=oai-smf-builder /openair-smf/build/smf/build/nas/libNAS.so .
RUN ldconfig
COPY --from=oai-smf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/libboost_system.so.1.67.0 \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/librtmp.so.1 \
/usr/lib/x86_64-linux-gnu/libpsl.so.5 \
/openair-smf/build/smf/build/nas/libNAS.so \
./
RUN ldconfig && \
ldd /openair-smf/bin/oai_smf
# Copying template configuration files
# The configuration folder will be flat
......
......@@ -42,14 +42,14 @@ RUN rm -f /etc/rhsm-host && \
yum install -y \
psmisc \
git \
diffutils \
file && \
diffutils \
file && \
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
WORKDIR /openair-smf
......@@ -58,15 +58,10 @@ COPY . /openair-smf
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs
RUN rm /etc/pki/entitlement/*pem
# debug
#WORKDIR /openair-smf
#RUN ldconfig -v && ldd /usr/local/bin/smf
#RUN ls -ls /usr/local/lib/
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf && \
rm /etc/pki/entitlement/*pem
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -76,33 +71,37 @@ 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 \
procps-ng \
net-tools \
libevent && \
psmisc \
tzdata \
procps-ng \
net-tools \
libevent && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder /openair-smf/build/smf/build/smf oai_smf
COPY --from=oai-smf-builder /usr/local/lib64/libpistache.so.0 /usr/lib64/
COPY --from=oai-smf-builder /usr/local/lib/libnghttp2_asio.so /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libgflags.so.2.1 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libglog.so.0 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libdouble-conversion.so.1 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libconfig++.so.9 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libboost_system.so.1.66.0 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libboost_thread.so.1.66.0 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libboost_chrono.so.1.66.0 /usr/lib64/
COPY --from=oai-smf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/lib64/
COPY --from=oai-smf-builder /usr/lib64/libasan.so.5 /usr/lib64/
COPY --from=oai-smf-builder /openair-smf/build/smf/build/nas/libNAS.so /usr/lib64/
COPY --from=oai-smf-builder /openair-smf/scripts/entrypoint.sh entrypoint.sh
# debug
#RUN ldconfig -v
#RUN ldd oai_smf
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
./
COPY --from=oai-smf-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_chrono.so.1.66.0 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib64/libasan.so.5 \
/openair-smf/build/smf/build/nas/libNAS.so \
/usr/lib64/
RUN ldconfig -v && \
ldd /openair-smf/bin/oai_smf
# Copying template configuration files
# The configuration folder will be flat
......@@ -115,5 +114,4 @@ WORKDIR /openair-smf
EXPOSE 80/tcp 9090/tcp 8805/udp
ENTRYPOINT ["/openair-smf/bin/entrypoint.sh"]
CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"]
......@@ -55,7 +55,9 @@ COPY . /openair-smf
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -83,20 +85,25 @@ RUN apt-get update && \
# Copying executable and generated libraries
WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder /openair-smf/build/smf/build/smf oai_smf
COPY --from=oai-smf-builder /openair-smf/scripts/entrypoint.sh .
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so .
COPY --from=oai-smf-builder /usr/local/lib/libnghttp2_asio.so.1 .
COPY --from=oai-smf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
COPY --from=oai-smf-builder /openair-smf/build/smf/build/nas/libNAS.so .
RUN ldconfig
COPY --from=oai-smf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/libboost_system.so.1.67.0 \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/librtmp.so.1 \
/usr/lib/x86_64-linux-gnu/libpsl.so.5 \
/openair-smf/build/smf/build/nas/libNAS.so \
./
RUN ldconfig && \
ldd /openair-smf/bin/oai_smf
# Copying template configuration files
# The configuration folder will be flat
......
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