Introduce multi-stage dockerfile
Docker image is a bit heavy (1.95GB) comparing to base rockylinux:9 image (176MB). We may benefit from multi-stage build, where srsLTE and UERANSIM repos are compiled in separate stage.
- compile srsLTE and UERANSIM in separate build stage - https://docs.docker.com/build/guide/multi-stage/
- consider static linking if it is easily achievable with cmake/configure flags
- install binaries/libs to
/usr/local/
directory (or maybe into/opt/
? you decide) - parallelize builds -
make -j
- merge dnf operations into single RUN command; remove dnf cache afterwards
- don't install unnecessary
*-devel
packages in final image - use
.dockerignore
to aggregate multiple COPY commands
Just by getting rid of cpp build artifacts and repos we should be able to reduce image size by over 600MB