Use single image for UERANSIM gNB + UE (Disk usage optimizations)

This commit is contained in:
herlesupreeth
2021-06-16 13:56:19 +02:00
parent 0ca95ac0d5
commit 500dd24fc8
7 changed files with 38 additions and 26 deletions

View File

@@ -49,11 +49,9 @@ docker-compose -f srsenb.yaml build --no-cache
docker-compose -f srsenb.yaml up -d && docker attach srsenb
# UERANSIM gNB
docker-compose -f nr-gnb.yaml build --no-cache
docker-compose -f nr-gnb.yaml up -d && docker attach nr_gnb
# UERANSIM NR-UE
docker-compose -f nr-ue.yaml build --no-cache
docker-compose -f nr-ue.yaml up -d && docker attach nr_ue
```

View File

@@ -1,10 +1,7 @@
version: '3'
services:
nr_gnb:
build:
context: ./ueransim
dockerfile: Dockerfile_nr_gnb
image: docker_nr_gnb
image: docker_ueransim
container_name: nr_gnb
stdin_open: true
tty: true
@@ -14,6 +11,8 @@ services:
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
environment:
- COMPONENT_NAME=ueransim-gnb-1
expose:
- "38412/sctp"
- "2152/udp"

View File

@@ -1,10 +1,7 @@
version: '3'
services:
nr_ue:
build:
context: ./ueransim
dockerfile: Dockerfile_nr_ue
image: docker_nr_ue
image: docker_ueransim
container_name: nr_ue
stdin_open: true
tty: true
@@ -14,6 +11,8 @@ services:
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
environment:
- COMPONENT_NAME=ueransim-ue-1
expose:
- "4997/udp"
cap_add:

View File

@@ -84,3 +84,6 @@ COPY --from=builder /UERANSIM/config /UERANSIM/config
# Set the working directory to UERANSIM
WORKDIR UERANSIM/build
COPY ueransim_image_init.sh /
CMD /ueransim_image_init.sh

View File

@@ -1,3 +1,5 @@
#!/bin/bash
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
@@ -24,8 +26,14 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM docker_ueransim
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
CMD /mnt/ueransim/ueransim_init.sh && \
./nr-gnb -c ../config/open5gs-gnb.yaml & \
bash
cp /mnt/ueransim/open5gs-gnb.yaml /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|AMF_IP|'$AMF_IP'|g' /UERANSIM/config/open5gs-gnb.yaml
# Sync docker time
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

View File

@@ -28,11 +28,7 @@
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
cp /mnt/ueransim/open5gs-gnb.yaml /UERANSIM/config/open5gs-gnb.yaml
cp /mnt/ueransim/open5gs-ue.yaml /UERANSIM/config/open5gs-ue.yaml
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/open5gs-ue.yaml
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/open5gs-ue.yaml
@@ -44,8 +40,5 @@ sed -i 's|UE1_IMEI|'$UE1_IMEI'|g' /UERANSIM/config/open5gs-ue.yaml
sed -i 's|UE1_IMSI|'$UE1_IMSI'|g' /UERANSIM/config/open5gs-ue.yaml
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/open5gs-ue.yaml
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/open5gs-gnb.yaml
sed -i 's|AMF_IP|'$AMF_IP'|g' /UERANSIM/config/open5gs-gnb.yaml
# Sync docker time
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

View File

@@ -1,3 +1,5 @@
#!/bin/bash
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
@@ -24,8 +26,18 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM docker_ueransim
CMD /mnt/ueransim/ueransim_init.sh && \
if [[ -z "$COMPONENT_NAME" ]]; then
echo "Error: COMPONENT_NAME environment variable not set"; exit 1;
elif [[ "$COMPONENT_NAME" =~ ^(ueransim-gnb-[[:digit:]]+$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/ueransim/open5gs_gnb_init.sh && \
./nr-gnb -c ../config/open5gs-gnb.yaml & \
bash
elif [[ "$COMPONENT_NAME" =~ ^(ueransim-ue-[[:digit:]]+$) ]]; then
echo "Deploying component: '$COMPONENT_NAME'"
/mnt/ueransim/open5gs_ue_init.sh && \
./nr-ue -c ../config/open5gs-ue.yaml & \
bash
else
echo "Error: Invalid component name: '$COMPONENT_NAME'"
fi