BUILD_IMAGES.md 13.3 KB
Newer Older
Raphael Defosseux's avatar
Raphael Defosseux committed
1
2
3
4
5
6
7
8
9
<table style="border-collapse: collapse; border: none;">
  <tr style="border-collapse: collapse; border: none;">
    <td style="border-collapse: collapse; border: none;">
      <a href="http://www.openairinterface.org/">
         <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150>
         </img>
      </a>
    </td>
    <td style="border-collapse: collapse; border: none; vertical-align: center;">
Sagar Arora's avatar
Sagar Arora committed
10
      <b><font size = "5">OpenAirInterface 5G Core Network Deployment : Building Container Images</font></b>
Raphael Defosseux's avatar
Raphael Defosseux committed
11
12
13
14
    </td>
  </tr>
</table>

Sagar Arora's avatar
Sagar Arora committed
15
# 1.  Retrieve the correct network function branches #
Raphael Defosseux's avatar
Raphael Defosseux committed
16

17
**CAUTION: PLEASE READ THIS SECTION VERY CAREFULLY!**
18

19
This repository only has tutorials and Continuous Integration scripts.
20

21
Each 5G Network Function source code is managed in its own repository.
Raphael Defosseux's avatar
Raphael Defosseux committed
22

23
They are called as `git sub-modules` in the `component` folder.
24

25
26
27
Before doing anything, you SHALL retrieve the code for each git sub-module.

## 1.1. You are interested on a very stable version. ##
28

29
We recommend to synchronize with the master branches on all git sub-modules.
30

31
We also recommend that you synchronize this "tutorial" repository with a provided tag. By doing so, the `docker-compose` files will be aligned with feature sets of each cNF.
32

33
**At the time of writing (2021/09/13), the release tag is `v1.2.0`.**
Sagar Arora's avatar
Sagar Arora committed
34

35
36
| CNF Name    | Branch Name | Tag      | Ubuntu 18.04 | RHEL8 (UBI8)    |
| ----------- | ----------- | -------- | ------------ | ----------------|
37
38
39
40
| FED REPO    | N/A         | `v1.2.0` |              |                 |
| AMF         | `master`    | `v1.2.0` | X            | X               |
| SMF         | `master`    | `v1.2.0` | X            | X               |
| NRF         | `master`    | `v1.2.0` | X            | X               |
41
| SPGW-U-TINY | `master`    | `v1.1.3` | X            | X               |
42
43
44
| UDR         | `master`    | `v1.2.0` | X            | X               |
| UDM         | `master`    | `v1.2.0` | X            | X               |
| AUSF        | `master`    | `v1.2.0` | X            | X               |
45
46
47

```bash
# Clone directly on the latest release tag
48
$ git clone --branch v1.2.0 https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
49
50
$ cd oai-cn5g-fed
# If you forgot to clone directly to the latest release tag
51
$ git checkout -f v1.2.0
Sagar Arora's avatar
Sagar Arora committed
52

53
54
55
56
57
58
59
# Synchronize all git submodules
$ ./scripts/syncComponents.sh
---------------------------------------------------------
OAI-NRF    component branch : master
OAI-AMF    component branch : master
OAI-SMF    component branch : master
OAI-SPGW-U component branch : master
60
61
62
OAI-UDR    component branch : master
OAI-UDM    component branch : master
OAI-AUSF   component branch : master
63
64
65
66
67
---------------------------------------------------------
git submodule deinit --all --force
git submodule init
git submodule update
```
Sagar Arora's avatar
Sagar Arora committed
68

69
or a little bit more dangerous
Sagar Arora's avatar
Sagar Arora committed
70

71
```bash
72
$ ./scripts/syncComponents.sh --nrf-branch v1.2.0 --amf-branch v1.2.0 \
73
                              --smf-branch v1.2.0 --spgwu-tiny-branch v1.1.3 \
74
75
                              --udr-branch v1.2.0 --udm-branch v1.2.0 \
                              --ausf-branch v1.2.0
76
---------------------------------------------------------
77
78
79
OAI-NRF    component branch : v1.2.0
OAI-AMF    component branch : v1.2.0
OAI-SMF    component branch : v1.2.0
80
OAI-SPGW-U component branch : v1.1.3
81
82
83
OAI-UDR    component branch : v1.2.0
OAI-UDM    component branch : v1.2.0
OAI-AUSF   component branch : v1.2.0
84
85
86
87
88
---------------------------------------------------------
git submodule deinit --all --force
git submodule init
git submodule update
```
Sagar Arora's avatar
Sagar Arora committed
89

90
## 1.2. You are interested on the latest features. ##
Sagar Arora's avatar
Sagar Arora committed
91

92
All the latest features are somehow pushed to the `develop` branches of each NF repository.
Sagar Arora's avatar
Sagar Arora committed
93

94
95
It means that we/you are able to build and the Continuous Integration test suite makes sure it
does NOT break any existing tested feature.
Sagar Arora's avatar
Sagar Arora committed
96

97
98
So for example, at time of writing, N2 Handover support code is included in `v1.1.0` release.
But it is not tested yet. So it is not advertized in the `CHANGELOG.md` and the Release Notes.
Sagar Arora's avatar
Sagar Arora committed
99

100
101
102
103
104
105
106
107
108
109
110
111
112
113
Anyhow, the tutorials' docker-compose files on the latest commit of the `master` branch of
`oai-cn5g-fed` repository SHALL support any additional un-tested feature.

```bash
# Clone
$ git clone  https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
$ cd oai-cn5g-fed
# On an existing repository, resync to the last `master` commit
$ git fetch --prune
$ git checkout master
$ git rebase origin/master

# Synchronize all git submodules
$ ./scripts/syncComponents.sh --nrf-branch develop --amf-branch develop \
114
115
116
                              --smf-branch develop --spgwu-tiny-branch develop \
                              --ausf-branch develop --udm-branch develop \
                              --udr-branch develop
Raphael Defosseux's avatar
Raphael Defosseux committed
117
---------------------------------------------------------
118
OAI-NRF    component branch : develop
Raphael Defosseux's avatar
Raphael Defosseux committed
119
120
OAI-AMF    component branch : develop
OAI-SMF    component branch : develop
121
OAI-SPGW-U component branch : develop
122
123
124
OAI-AUSF   component branch : develop
OAI-UDM    component branch : develop
OAI-UDR    component branch : develop
Raphael Defosseux's avatar
Raphael Defosseux committed
125
---------------------------------------------------------
126
127
128
git submodule deinit --all --force
git submodule init
git submodule update
Raphael Defosseux's avatar
Raphael Defosseux committed
129
130
131
132
133
134
135
136
137
```

# 2. Generic Parameters #

Here in our network configuration, we need to pass the "GIT PROXY" configuration.

*   If you do not need, remove the `--build-arg NEEDED_GIT_PROXY=".."` option.
*   If you do need it, change with your proxy value.

138
139
140
141
142
If you have re-building CN5G images, be careful that `docker` or `podman` may re-use `cached` blobs
to construct the intermediate layers.

We recommend to add the `--no-cache` option in that case.

Raphael Defosseux's avatar
Raphael Defosseux committed
143
144
145
146
147
# 3. Build AMF Image #

## 3.1 On a Ubuntu 18.04 Host ##

```bash
148
$ docker build --target oai-amf --tag oai-amf:latest \
149
               --file component/oai-amf/docker/Dockerfile.amf.ubuntu18 \
Raphael Defosseux's avatar
Raphael Defosseux committed
150
151
152
153
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-amf
$ docker image prune --force
$ docker image ls
154
oai-amf                 latest             f478bafd7a06        1 minute ago          279MB
Raphael Defosseux's avatar
Raphael Defosseux committed
155
156
157
...
```

Sagar Arora's avatar
Sagar Arora committed
158
159
## 3.2 On a RHEL8 Host ##

160
161
162
163
RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-amf repository in a new folder named `tmp` before building the image.
Sagar Arora's avatar
Sagar Arora committed
164
165

```bash
166
$ sudo podman build --target oai-amf --tag oai-amf:latest \
167
               --file component/oai-amf/docker/Dockerfile.amf.rhel8 \
Sagar Arora's avatar
Sagar Arora committed
168
169
170
171
172
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-amf
...
```

173
The above command is with podman, in case of docker it can be changed with its docker equivalent.
Sagar Arora's avatar
Sagar Arora committed
174
175


Raphael Defosseux's avatar
Raphael Defosseux committed
176
177
178
179
180
# 4. Build SMF Image #

## 4.1 On a Ubuntu 18.04 Host ##

```bash
181
$ docker build --target oai-smf --tag oai-smf:latest \
182
               --file component/oai-smf/docker/Dockerfile.smf.ubuntu18 \
Raphael Defosseux's avatar
Raphael Defosseux committed
183
184
185
186
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-smf
$ docker image prune --force
$ docker image ls
187
oai-smf                 latest             f478bafd7a06        1 minute ago          293MB
Raphael Defosseux's avatar
Raphael Defosseux committed
188
189
190
...
```

Sagar Arora's avatar
Sagar Arora committed
191
192
## 4.2 On a RHEL8 Host ##

193
194
195
196
RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-smf repository in a new folder named `tmp` before building the image.
Sagar Arora's avatar
Sagar Arora committed
197
198

```bash
199
$ sudo podman build --target oai-smf --tag oai-smf:latest \
200
               --file component/oai-smf/docker/Dockerfile.smf.rhel8 \
Sagar Arora's avatar
Sagar Arora committed
201
202
203
204
205
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-smf
...
```

206
The above command is with podman, in case of docker it can be changed with its docker equivalent.
Sagar Arora's avatar
Sagar Arora committed
207

Sagar Arora's avatar
Sagar Arora committed
208
# 5. Build NRF Image #
Raphael Defosseux's avatar
Raphael Defosseux committed
209
210
211

## 5.1 On a Ubuntu 18.04 Host ##

Sagar Arora's avatar
Sagar Arora committed
212
```bash
213
$ docker build --target oai-nrf --tag oai-nrf:latest \
214
               --file component/oai-nrf/docker/Dockerfile.nrf.ubuntu18 \
215
216
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-nrf
Sagar Arora's avatar
Sagar Arora committed
217
218
$ docker image prune --force
$ docker image ls
219
oai-nrf                 latest             04334b29e103        1 minute ago          247MB
Sagar Arora's avatar
Sagar Arora committed
220
221
222
...
```

Sagar Arora's avatar
Sagar Arora committed
223
224
## 5.2 On a RHEL8 Host ##

225
226
227
228
RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-nrf repository in a new folder named `tmp` before building the image.
Sagar Arora's avatar
Sagar Arora committed
229
230

```bash
231
$ sudo podman build --target oai-nrf --tag oai-nrf:latest \
232
               --file component/oai-nrf/docker/Dockerfile.nrf.rhel8 \
Sagar Arora's avatar
Sagar Arora committed
233
234
235
236
237
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-nrf
...
```

238
The above command is with podman, in case of docker it can be changed with its docker equivalent.
Sagar Arora's avatar
Sagar Arora committed
239
240
241
242
243

# 6. Build SPGW-U Image #

## 6.1 On a Ubuntu 18.04 Host ##

Raphael Defosseux's avatar
Raphael Defosseux committed
244
```bash
245
$ docker build --target oai-spgwu-tiny --tag oai-spgwu-tiny:latest \
246
               --file component/oai-upf-equivalent/docker/Dockerfile.ubuntu18.04 \
247
248
               --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-upf-equivalent
Raphael Defosseux's avatar
Raphael Defosseux committed
249
250
$ docker image prune --force
$ docker image ls
251
oai-spgwu-tiny          latest             dec6311cef3b        1 minute ago          255MB
Raphael Defosseux's avatar
Raphael Defosseux committed
252
253
254
...
```

Sagar Arora's avatar
Sagar Arora committed
255
256
## 6.2 On a RHEL8 Host ##

257
258
259
260
RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-spgwu repository in a new folder named `tmp` before building the image.
Sagar Arora's avatar
Sagar Arora committed
261
262

```bash
263
$ sudo podman build --target oai-spgwu-tiny --tag oai-spgwu-tiny:latest \
Sagar Arora's avatar
Sagar Arora committed
264
265
266
267
268
269
               --file component/oai-spgwu-tiny/docker/Dockerfile.centos8 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-upf-equivalent
...
```

270
The above command is with podman, in case of docker it can be changed with its docker equivalent.
Sagar Arora's avatar
Sagar Arora committed
271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# 7. Build AUSF Image #

## 7.1 On a Ubuntu 18.04 Host ##

```bash
$ docker build --target oai-ausf --tag oai-ausf:latest \
               --file component/oai-ausf/docker/Dockerfile.ausf.ubuntu18 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-ausf
$ docker image prune --force
$ docker image ls
oai-ausf          latest              77a96de94c23        1 minute ago        231MB
...
```

## 7.2 On a RHEL8 Host ##

RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-nrf repository in a new folder named `tmp` before building the image.

```bash
$ sudo podman build --target oai-ausf --tag oai-ausf:latest \
               --file component/oai-ausf/docker/Dockerfile.ausf.rhel8 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-ausf
...
```

The above command is with podman, in case of docker it can be changed with its docker equivalent.

# 8. Build UDM Image #

## 8.1 On a Ubuntu 18.04 Host ##

```bash
$ docker build --target oai-udm --tag oai-udm:latest \
               --file component/oai-udm/docker/Dockerfile.udm.ubuntu18 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-udm
$ docker image prune --force
$ docker image ls
oai-udm                 latest             10a4334e31be        1 minute ago          229MB
...
```

## 8.2 On a RHEL8 Host ##

RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-nrf repository in a new folder named `tmp` before building the image.

```bash
$ sudo podman build --target oai-udm --tag oai-udm:latest \
               --file component/oai-udm/docker/Dockerfile.udm.rhel8 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-udm
...
```

The above command is with podman, in case of docker it can be changed with its docker equivalent.

# 9. Build UDR Image #

## 9.1 On a Ubuntu 18.04 Host ##

```bash
$ docker build --target oai-udr --tag oai-udr:latest \
               --file component/oai-udr/docker/Dockerfile.udr.ubuntu18 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-udr
$ docker image prune --force
$ docker image ls
oai-udr                 latest             581e07d59ec3        1 minute ago          234MB
...
```

## 9.2 On a RHEL8 Host ##

RHEL base images generally needs a subscription to access the package repository.
For that the base image needs ca and entitlement .pem files.

Copy the ca and entitlement .pem files in the oai-nrf repository in a new folder named `tmp` before building the image.

```bash
$ sudo podman build --target oai-udr --tag oai-udr:latest \
               --file component/oai-udr/docker/Dockerfile.udr.rhel8 \
               --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
               component/oai-udr
...
```

The above command is with podman, in case of docker it can be changed with its docker equivalent.


Raphael Defosseux's avatar
Raphael Defosseux committed
369
You are ready to [Configure the Containers](./CONFIGURE_CONTAINERS.md) or deploying the images using [helm-charts](./DEPLOY_SA5G_HC.md)