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
|
||||
ARG SANITIZE_OPTION
|
||||
|
||||
RUN rm -Rf /oai-ran
|
||||
WORKDIR /oai-ran
|
||||
@@ -35,4 +36,6 @@ COPY . .
|
||||
RUN /bin/sh oaienv && \
|
||||
cd cmake_targets && \
|
||||
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
|
||||
FROM ubuntu:focal as oai-enb
|
||||
ARG SANITIZE_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -57,6 +58,11 @@ RUN apt-get update && \
|
||||
python3-six \
|
||||
python3-requests \
|
||||
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/*
|
||||
|
||||
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" && \
|
||||
/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
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS gnb-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-gnb
|
||||
ARG SANITIZE_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe
|
||||
|
||||
@@ -56,6 +57,11 @@ RUN apt-get update && \
|
||||
python3-six \
|
||||
python3-requests \
|
||||
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/*
|
||||
|
||||
WORKDIR /opt/oai-gnb/bin
|
||||
@@ -91,7 +97,8 @@ COPY --from=gnb-base \
|
||||
/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
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
|
||||
#EXPOSE 2152/udp # S1U, GTP/UDP
|
||||
|
||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS lte-ue-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-lte-ue
|
||||
ARG SANITIZE_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -56,6 +57,11 @@ RUN apt-get update && \
|
||||
iputils-ping \
|
||||
iproute2 \
|
||||
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/*
|
||||
|
||||
WORKDIR /opt/oai-lte-ue/bin
|
||||
@@ -94,7 +100,8 @@ COPY --from=lte-ue-base \
|
||||
/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
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
|
||||
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
|
||||
ARG SANITIZE_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe
|
||||
|
||||
@@ -40,6 +41,11 @@ RUN apt-get update && \
|
||||
libsctp1 \
|
||||
libconfig9 \
|
||||
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/*
|
||||
|
||||
WORKDIR /opt/oai-gnb/bin
|
||||
|
||||
@@ -32,6 +32,7 @@ FROM ran-build:latest AS nr-ue-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-nr-ue
|
||||
ARG SANITIZE_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -56,6 +57,10 @@ RUN apt-get update && \
|
||||
iputils-ping \
|
||||
iproute2 \
|
||||
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/*
|
||||
|
||||
WORKDIR /opt/oai-nr-ue/bin
|
||||
@@ -95,7 +100,8 @@ COPY --from=nr-ue-base \
|
||||
/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
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
|
||||
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`.
|
||||
|
||||
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 ##
|
||||
|
||||
For example, the eNB:
|
||||
@@ -141,6 +158,14 @@ docker image prune --force
|
||||
|
||||
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 #
|
||||
|
||||
Analogous to the above steps:
|
||||
|
||||
Reference in New Issue
Block a user