Update Makefile and build options

This commit is contained in:
Borjis131
2024-05-15 17:39:52 +02:00
parent 6981fd40db
commit 84cb158c29
4 changed files with 76 additions and 13 deletions

View File

@@ -1,7 +1,53 @@
# include docker-compose .env file
include .env
.PHONY: build-base-open5gs
.PHONY: base-open5gs amf ausf bsf nrf nssf pcf scp sepp smf udm udr upf webui all clean
build-base-open5gs:
base-open5gs:
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t base-open5gs:${OPEN5GS_VERSION} ./images/base-open5gs
amf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t amf:${OPEN5GS_VERSION} ./images/amf
ausf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t ausf:${OPEN5GS_VERSION} ./images/ausf
bsf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t bsf:${OPEN5GS_VERSION} ./images/bsf
nrf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t nrf:${OPEN5GS_VERSION} ./images/nrf
nssf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t nssf:${OPEN5GS_VERSION} ./images/nssf
pcf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t pcf:${OPEN5GS_VERSION} ./images/pcf
scp: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t scp:${OPEN5GS_VERSION} ./images/scp
sepp: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t sepp:${OPEN5GS_VERSION} ./images/sepp
smf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t smf:${OPEN5GS_VERSION} ./images/smf
udm: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t udm:${OPEN5GS_VERSION} ./images/udm
udr: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t udr:${OPEN5GS_VERSION} ./images/udr
upf: base-open5gs
docker build --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t upf:${OPEN5GS_VERSION} ./images/upf
webui:
docker build --build-arg NODE_VERSION=${NODE_VERSION} --build-arg OPEN5GS_VERSION=${OPEN5GS_VERSION} -t webui:${OPEN5GS_VERSION} ./images/webui
all: base-open5gs amf ausf bsf nrf nssf pcf scp sepp smf udm udr upf webui
clean:
docker image remove base-open5gs:${OPEN5GS_VERSION} amf:${OPEN5GS_VERSION} ausf:${OPEN5GS_VERSION} bsf:${OPEN5GS_VERSION} nrf:${OPEN5GS_VERSION} nssf:${OPEN5GS_VERSION} \
pcf:${OPEN5GS_VERSION} scp:${OPEN5GS_VERSION} sepp:${OPEN5GS_VERSION} smf:${OPEN5GS_VERSION} udm:${OPEN5GS_VERSION} udr:${OPEN5GS_VERSION} upf:${OPEN5GS_VERSION} \
webui:${OPEN5GS_VERSION}

View File

@@ -29,11 +29,27 @@ All the images depend on the base image. So first, update the `.env` file with t
- Default value: The one specified in the `.env` file
- Tested values: 3.6.8, 4.2, 6.0
`NODE_VERSION` is the version of Node.js being used to build the Open5GS WebUI.
- Accepted values are the tags used by Node in Docker Hub for its bookworm-slim image and the Node.js dependency of Open5GS WebUI
- Default value: 20
- Tested values: 20
`DOCKER_HOST_IP` is the IP address of the host running Docker. This modifies the `advertise` field in the `upf.yaml` config file for this to work when exposing the Docker containers network.
## Build it (2 ways)
### First way (make + docker compose build)
### First way (docker buildx bake)
>Note: Requires docker-buildx-plugin
With this method, you can build all the images all at once with a single command (taking advantage of docker buildx parallelism), run:
```bash
docker buildx bake
```
>Note: This command uses the `docker-bake.hcl` file, please update the `OPEN5GS_VERSION`, `UBUNTU_VERSION` and `NODE_VERSION` variables there before running it.
### Second way (make + docker compose)
>Note: Requires make and docker-compose-plugin
@@ -44,23 +60,23 @@ make
This will take a while, after this you will have the base image called `base-open5gs`, tagged with the `OPEN5GS_VERSION` selected.
After this you can run the following to create the Network Functions images:
Or you can run the following to create the base image and all the Network Function images:
```bash
make all
```
Some deployments have the build instructions for the images (like the `basic` deployment), only depending of the `base-open5gs` image:
```bash
# Example using the basic deployment
docker compose -f compose-files/basic/docker-compose.yaml --env-file=.env up -d
```
### Second way (docker buildx bake)
>Note: Requires docker-buildx-plugin
With this method, you can build all the images all at once with a single command, run:
Some other deployments download the images needed from container registries like Docker Hub or GitHub Container Registry (like the `network-slicing` deployment):
```bash
docker buildx bake
# Example using the network-slicing deployment
docker compose -f compose-files/network-slicing/docker-compose.yaml --env-file=.env up -d
```
>Note: This command uses the `docker-bake.hcl` file, please update the `OPEN5GS_VERSION` and `UBUNTU_VERSION` variables there before running it.
## Use it
```bash

View File

@@ -6,6 +6,7 @@ It is normal to see:
```bash
WARN[0297]
volume "open5gs_db_data" already exists but was not created for project "<deployment_name>".
volume "open5gs_db_config" already exists but was not created for project "<deployment_name>".
```
It is only a warning, telling you that the Docker volume exists.

View File

@@ -25,7 +25,7 @@ You can use the Open5GS `open5gs-dbctl` script in the host to add users to the d
The database Docker volume is marked with a label `org.open5gs.mongodb_version` indicating the `MONGODB_VERSION` selected in the `.env` file. This marks the version used for the mongo container. This label is needed to debug issues with users changing the mongo container version but keeping the Docker volumes created.
> When upgrading/downgrading the `MONGODB_VERSION` the existing `open5gs_db_data` Docker volume could cause problems/crashing. It is recommended to remove it.
> When upgrading/downgrading the `MONGODB_VERSION` the existing `open5gs_db_data` and `open5gs_db_config` Docker volumes could cause problems/crashing. It is recommended to remove them.
### Network Function configuration