Commit e5cbea88 authored by Raphael Defosseux's avatar Raphael Defosseux

docker(build): optimization on the number of layers

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 2fefe070
...@@ -41,7 +41,9 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git ...@@ -41,7 +41,9 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git
# Building UDR # Building UDR
WORKDIR /openair-udr/build/scripts WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force RUN ./build_udr --install-deps --force
RUN ./build_udr --clean --Verbose --build-type Release --jobs RUN ./build_udr --clean --Verbose --build-type Release --jobs && \
ldd /openair-udr/build/udr/build/udr && \
mv /openair-udr/build/udr/build/udr /openair-udr/build/udr/build/oai_udr
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
...@@ -71,15 +73,20 @@ RUN apt-get update && \ ...@@ -71,15 +73,20 @@ RUN apt-get update && \
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-udr/bin WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr COPY --from=oai-udr-builder \
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh . /openair-udr/build/udr/build/oai_udr \
COPY --from=oai-udr-builder /wait-for-it/wait-for-it.sh . /openair-udr/scripts/entrypoint.sh \
/wait-for-it/wait-for-it.sh \
./
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/ COPY --from=oai-udr-builder \
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/ /usr/local/lib/libpistache.so \
COPY --from=oai-udr-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/local/lib/ /usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
./
RUN ldconfig RUN ldconfig && \
ldd /openair-udr/bin/oai_udr
WORKDIR /openair-udr/etc WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf . COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
......
...@@ -70,7 +70,9 @@ WORKDIR /openair-udr/build/scripts ...@@ -70,7 +70,9 @@ WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force RUN ./build_udr --install-deps --force
# Patching the CMakefile to link mysqlclient # Patching the CMakefile to link mysqlclient
RUN sed -i -e "s@-lmysqlclient@-L/usr/lib64/mysql -lmysqlclient@" ../../src/oai_udr/CMakeLists.txt && \ RUN sed -i -e "s@-lmysqlclient@-L/usr/lib64/mysql -lmysqlclient@" ../../src/oai_udr/CMakeLists.txt && \
./build_udr --clean --Verbose --build-type Release --jobs ./build_udr --clean --Verbose --build-type Release --jobs && \
ldd /openair-udr/build/udr/build/udr && \
mv /openair-udr/build/udr/build/udr /openair-udr/build/udr/build/oai_udr
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
...@@ -96,21 +98,26 @@ RUN yum update -y && \ ...@@ -96,21 +98,26 @@ RUN yum update -y && \
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-udr/bin WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr COPY --from=oai-udr-builder \
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh . /openair-udr/build/udr/build/oai_udr \
COPY --from=oai-udr-builder /wait-for-it/wait-for-it.sh . /openair-udr/scripts/entrypoint.sh \
/wait-for-it/wait-for-it.sh \
./
WORKDIR /usr/local/lib64 WORKDIR /usr/local/lib64
COPY --from=oai-udr-builder /usr/local/lib64/libpistache.so.0 . COPY --from=oai-udr-builder \
COPY --from=oai-udr-builder /lib64/libboost_system.so.1.66.0 . /usr/local/lib64/libpistache.so.0 \
COPY --from=oai-udr-builder /lib64/libboost_thread.so.1.66.0 . /lib64/libboost_system.so.1.66.0 \
COPY --from=oai-udr-builder /lib64/libboost_date_time.so.1.66.0 . /lib64/libboost_thread.so.1.66.0 \
COPY --from=oai-udr-builder /lib64/libconfig++.so.9 . /lib64/libboost_date_time.so.1.66.0 \
COPY --from=oai-udr-builder /lib64/libnghttp2.so.14 . /lib64/libconfig++.so.9 \
COPY --from=oai-udr-builder /usr/lib64/mysql/libmysqlclient.so.21 . /lib64/libnghttp2.so.14 \
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/lib64/ /usr/lib64/mysql/libmysqlclient.so.21 \
/usr/local/lib/libnghttp2_asio.so.1 \
RUN ldconfig ./
RUN ldconfig && \
ldd /openair-udr/bin/oai_udr
WORKDIR /openair-udr/etc WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf . COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
......
...@@ -57,7 +57,9 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git ...@@ -57,7 +57,9 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git
# Installing and Building UDR # Installing and Building UDR
WORKDIR /openair-udr/build/scripts WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force RUN ./build_udr --install-deps --force
RUN ./build_udr --clean --Verbose --build-type Release --jobs RUN ./build_udr --clean --Verbose --build-type Release --jobs && \
ldd /openair-udr/build/udr/build/udr && \
mv /openair-udr/build/udr/build/udr /openair-udr/build/udr/build/oai_udr
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
...@@ -87,15 +89,20 @@ RUN apt-get update && \ ...@@ -87,15 +89,20 @@ RUN apt-get update && \
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-udr/bin WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr COPY --from=oai-udr-builder \
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh . /openair-udr/build/udr/build/oai_udr \
COPY --from=oai-udr-builder /wait-for-it/wait-for-it.sh . /openair-udr/scripts/entrypoint.sh \
/wait-for-it/wait-for-it.sh \
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/ ./
COPY --from=oai-udr-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-udr-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/local/lib/ COPY --from=oai-udr-builder \
/usr/local/lib/libpistache.so \
RUN ldconfig /usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
./
RUN ldconfig && \
ldd /openair-udr/bin/oai_udr
WORKDIR /openair-udr/etc WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf . COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
......
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