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