chore(ci): adding support for address-sanitizer images' build in dockerfiles
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
committed by
Robert Schmidt
parent
6debc5dd21
commit
2a82e36e71
@@ -26,6 +26,7 @@
|
|||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
FROM ran-base:latest as ran-build
|
FROM ran-base:latest as ran-build
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
|
|
||||||
RUN rm -Rf /oai-ran
|
RUN rm -Rf /oai-ran
|
||||||
WORKDIR /oai-ran
|
WORKDIR /oai-ran
|
||||||
@@ -35,4 +36,6 @@ COPY . .
|
|||||||
RUN /bin/sh oaienv && \
|
RUN /bin/sh oaienv && \
|
||||||
cd cmake_targets && \
|
cd cmake_targets && \
|
||||||
mkdir -p log && \
|
mkdir -p log && \
|
||||||
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
|
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror $SANITIZE_OPTION && \
|
||||||
|
# Mainly to see if the sanitize option was perfectly executed
|
||||||
|
ldd ran_build/build/nr-softmodem
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS enb-build
|
|||||||
|
|
||||||
#start from scratch for target executable
|
#start from scratch for target executable
|
||||||
FROM ubuntu:focal as oai-enb
|
FROM ubuntu:focal as oai-enb
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Europe/Paris
|
ENV TZ=Europe/Paris
|
||||||
|
|
||||||
@@ -57,6 +58,11 @@ RUN apt-get update && \
|
|||||||
python3-six \
|
python3-six \
|
||||||
python3-requests \
|
python3-requests \
|
||||||
libusb-1.0-0 && \
|
libusb-1.0-0 && \
|
||||||
|
# if the --sanitize option was used to build, additional packages are required
|
||||||
|
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||||
|
libasan5 \
|
||||||
|
libubsan1 \
|
||||||
|
liblapacke; fi' && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/oai-enb/bin
|
WORKDIR /opt/oai-enb/bin
|
||||||
@@ -93,8 +99,8 @@ COPY --from=enb-base \
|
|||||||
|
|
||||||
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
||||||
/bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so /usr/local/lib/liboai_transpro.so" && \
|
/bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so /usr/local/lib/liboai_transpro.so" && \
|
||||||
ldconfig
|
ldconfig && \
|
||||||
|
ldd /opt/oai-enb/bin/lte-softmodem
|
||||||
|
|
||||||
WORKDIR /opt/oai-enb
|
WORKDIR /opt/oai-enb
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS gnb-build
|
|||||||
|
|
||||||
#start from scratch for target executable
|
#start from scratch for target executable
|
||||||
FROM ubuntu:focal as oai-gnb
|
FROM ubuntu:focal as oai-gnb
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Europe
|
ENV TZ=Europe
|
||||||
|
|
||||||
@@ -56,6 +57,11 @@ RUN apt-get update && \
|
|||||||
python3-six \
|
python3-six \
|
||||||
python3-requests \
|
python3-requests \
|
||||||
libusb-1.0-0 && \
|
libusb-1.0-0 && \
|
||||||
|
# if the --sanitize option was used to build, additional packages are required
|
||||||
|
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||||
|
libasan5 \
|
||||||
|
libubsan1 \
|
||||||
|
liblapacke; fi' && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/oai-gnb/bin
|
WORKDIR /opt/oai-gnb/bin
|
||||||
@@ -91,7 +97,8 @@ COPY --from=gnb-base \
|
|||||||
/usr/lib/x86_64-linux-gnu/
|
/usr/lib/x86_64-linux-gnu/
|
||||||
|
|
||||||
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
||||||
ldconfig
|
ldconfig && \
|
||||||
|
ldd /opt/oai-gnb/bin/nr-softmodem
|
||||||
|
|
||||||
WORKDIR /opt/oai-gnb
|
WORKDIR /opt/oai-gnb
|
||||||
#EXPOSE 2152/udp # S1U, GTP/UDP
|
#EXPOSE 2152/udp # S1U, GTP/UDP
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS lte-ue-build
|
|||||||
|
|
||||||
#start from scratch for target executable
|
#start from scratch for target executable
|
||||||
FROM ubuntu:focal as oai-lte-ue
|
FROM ubuntu:focal as oai-lte-ue
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Europe/Paris
|
ENV TZ=Europe/Paris
|
||||||
|
|
||||||
@@ -56,6 +57,11 @@ RUN apt-get update && \
|
|||||||
iputils-ping \
|
iputils-ping \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
iperf && \
|
iperf && \
|
||||||
|
# if the --sanitize option was used to build, additional packages are required
|
||||||
|
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||||
|
libasan5 \
|
||||||
|
libubsan1 \
|
||||||
|
liblapacke; fi' && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/oai-lte-ue/bin
|
WORKDIR /opt/oai-lte-ue/bin
|
||||||
@@ -94,7 +100,8 @@ COPY --from=lte-ue-base \
|
|||||||
/usr/lib/x86_64-linux-gnu/
|
/usr/lib/x86_64-linux-gnu/
|
||||||
|
|
||||||
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
||||||
ldconfig
|
ldconfig && \
|
||||||
|
ldd /opt/oai-lte-ue/bin/lte-uesoftmodem
|
||||||
|
|
||||||
WORKDIR /opt/oai-lte-ue
|
WORKDIR /opt/oai-lte-ue
|
||||||
CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem"]
|
CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem"]
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ FROM ran-build:latest AS gnb-build
|
|||||||
|
|
||||||
|
|
||||||
FROM ubuntu:focal as oai-nr-cuup
|
FROM ubuntu:focal as oai-nr-cuup
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Europe
|
ENV TZ=Europe
|
||||||
|
|
||||||
@@ -40,6 +41,11 @@ RUN apt-get update && \
|
|||||||
libsctp1 \
|
libsctp1 \
|
||||||
libconfig9 \
|
libconfig9 \
|
||||||
openssl && \
|
openssl && \
|
||||||
|
# if the --sanitize option was used to build, additional packages are required
|
||||||
|
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||||
|
libasan5 \
|
||||||
|
libubsan1 \
|
||||||
|
liblapacke; fi' && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/oai-gnb/bin
|
WORKDIR /opt/oai-gnb/bin
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS nr-ue-build
|
|||||||
|
|
||||||
#start from scratch for target executable
|
#start from scratch for target executable
|
||||||
FROM ubuntu:focal as oai-nr-ue
|
FROM ubuntu:focal as oai-nr-ue
|
||||||
|
ARG SANITIZE_OPTION
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV TZ=Europe/Paris
|
ENV TZ=Europe/Paris
|
||||||
|
|
||||||
@@ -56,6 +57,10 @@ RUN apt-get update && \
|
|||||||
iputils-ping \
|
iputils-ping \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
iperf && \
|
iperf && \
|
||||||
|
# if the --sanitize option was used to build, additional packages are required
|
||||||
|
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||||
|
libasan5 \
|
||||||
|
libubsan1; fi' && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/oai-nr-ue/bin
|
WORKDIR /opt/oai-nr-ue/bin
|
||||||
@@ -95,7 +100,8 @@ COPY --from=nr-ue-base \
|
|||||||
/usr/lib/x86_64-linux-gnu/
|
/usr/lib/x86_64-linux-gnu/
|
||||||
|
|
||||||
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \
|
||||||
ldconfig
|
ldconfig && \
|
||||||
|
ldd /opt/oai-nr-ue/bin/nr-uesoftmodem
|
||||||
|
|
||||||
WORKDIR /opt/oai-nr-ue
|
WORKDIR /opt/oai-nr-ue
|
||||||
CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/nr-ue.conf"]
|
CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/nr-ue.conf"]
|
||||||
|
|||||||
@@ -114,6 +114,23 @@ ran-base latest 5c9c02a5b4a8 1 minute ago
|
|||||||
|
|
||||||
Note that the steps are identical for `rocky-linux`.
|
Note that the steps are identical for `rocky-linux`.
|
||||||
|
|
||||||
|
You can also create `address-sanitizer` version of the ran-build image. This is only available for the Ubuntu-20 version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build --target ran-build --tag ran-build:latest --file docker/Dockerfile.build.ubuntu20 --build-arg "SANITIZE_OPTION=--sanitize" .
|
||||||
|
```
|
||||||
|
|
||||||
|
After building:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker image ls
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
ran-build latest f2633a7f5102 1 minute ago 8.78GB
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the image is much bigger.
|
||||||
|
|
||||||
## 3.3. Building any target image ##
|
## 3.3. Building any target image ##
|
||||||
|
|
||||||
For example, the eNB:
|
For example, the eNB:
|
||||||
@@ -141,6 +158,14 @@ docker image prune --force
|
|||||||
|
|
||||||
Note that the steps are identical for `rocky-linux`.
|
Note that the steps are identical for `rocky-linux`.
|
||||||
|
|
||||||
|
If you have used the sanitizer option, then you should also pass it when building the target image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build --target oai-gnb --tag oai-gnb:latest --file docker/Dockerfile.gNB.ubuntu20 --build-arg "SANITIZE_OPTION=--sanitize" .
|
||||||
|
```
|
||||||
|
|
||||||
|
Normally the target image will be around 200 Mbytes bigger.
|
||||||
|
|
||||||
# 4. Building using `podman` under Red Hat Entreprise Linux 8.2 #
|
# 4. Building using `podman` under Red Hat Entreprise Linux 8.2 #
|
||||||
|
|
||||||
Analogous to the above steps:
|
Analogous to the above steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user