@@ -37,7 +37,7 @@ ARG NUM_JOBS=""
3737# Stage 1: Build #
3838# #################
3939
40- FROM ubuntu:$OS_VERSION AS builder
40+ FROM ubuntu:$OS_VERSION AS builder-base
4141
4242# Adding the complete repo to the context, in /src folder
4343ADD . /src
@@ -47,19 +47,36 @@ ADD . /src
4747
4848# Install srsRAN build dependencies
4949RUN /src/docker/scripts/install_dependencies.sh build && \
50- /src/docker/scripts/install_rohc_dependencies.sh build && \
5150 /src/docker/scripts/install_uhd_dependencies.sh build && \
5251 /src/docker/scripts/install_dpdk_dependencies.sh build && \
5352 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git clang
5453
54+
55+
56+ FROM builder-base AS builder-rohc
57+
58+ ARG MARCH
59+ ARG NUM_JOBS
60+
61+ RUN /src/docker/scripts/install_rohc_dependencies.sh build
62+
63+ # Compile ROHC
64+ RUN /src/docker/scripts/build_rohc.sh ${MARCH} ${NUM_JOBS}
65+
66+
67+
68+ FROM builder-base AS builder
69+
5570ARG UHD_VERSION
5671ARG DPDK_VERSION
5772ARG MARCH
5873ARG NUM_JOBS
5974
60- # Compile ROHC/UHD/DPDK
61- RUN /src/docker/scripts/build_rohc.sh ${MARCH} ${NUM_JOBS} && \
62- /src/docker/scripts/build_uhd.sh "${UHD_VERSION}" ${MARCH} ${NUM_JOBS} && \
75+ # Copy ROHC binaries and libraries installed in builder-rohc stage (without taking ROHC build deps that confuse DPDK build)
76+ COPY --from=builder-rohc /opt/rohc /opt/rohc
77+
78+ # Compile UHD/DPDK
79+ RUN /src/docker/scripts/build_uhd.sh "${UHD_VERSION}" ${MARCH} ${NUM_JOBS} && \
6380 /src/docker/scripts/build_dpdk.sh "${DPDK_VERSION}" ${MARCH} ${NUM_JOBS}
6481
6582# Compile srsRAN Project and install it in the OS
@@ -99,7 +116,7 @@ FROM ubuntu:$OS_VERSION AS runtime
99116ARG UHD_VERSION
100117ARG DPDK_VERSION
101118
102- # Copy srsRAN binaries and libraries installed in previous stage
119+ # Copy srsRAN binaries and libraries installed in previous stage(s)
103120COPY --from=builder /opt/rohc /opt/rohc
104121COPY --from=builder /opt/uhd/${UHD_VERSION} /opt/uhd/${UHD_VERSION}
105122COPY --from=builder /opt/dpdk/${DPDK_VERSION} /opt/dpdk/${DPDK_VERSION}
0 commit comments