1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# agl-docker-worker
## Purpose
This repository contains some scripts to generate a Docker image suitable for AGL workers.
The AGL worker image is a Docker image based on Debian 10 and contains the necessary tools
either to build platform images based on Yocto, or run the AGL SDK to build AGL Applications
outside of Yocto process.
## Requirements
Have a recent docker daemon (>=1.10) installed. All the setup is done inside the
image so no other tool is required on the host.
## Usage
To get some help, simply run:
```
make help
```
Typically, the sequence to build an image is:
```
# make build
...
# make export
...
# make clean
```
By default, the flavour 'generic' is used: the resulting container has multiple capabilities
(platform build, sdk build, documentation compiling etc.) at the cost of size.
To change the flavour, specify FLAVOUR=your_flavour on the command line. For example:
```
# make build FLAVOUR=xds
...
# make export FLAVOUR=xds
...
# make clean FLAVOUR=xds
```
## How it works
The Dockerfile is generic: it simply inherits from a Debian image.
When running a 'make build':
* the Makefile creates a temp file INSTALL/flavour.conf to record the selected flavour
* Docker instantiates a new container based on the latest Debian image
* Docker copies the INSTALL folder inside the container in /root/INSTALL
* then it runs the setup script /root/INSTALL/setup_image.sh
In turn, this setup script will:
* source the configuration file /root/INSTALL/image.conf
* source the flavour file /root/INSTALL/flavour.conf
* execute all scripts contained in /root/INSTALL/common.d
* execute all scripts located in /root/INSTALL/tasks.d and referenced from INSTALL/flavours/$FLAVOUR.tasks
When the setup script finishes, Docker commits the temporary container in a new image.
This image can then be exported to a tarball and/or pushed to a Docker registry.
## Using the generated image
### Grab the image
To publish the image, there are 2 ways: using a docker registry OR exporting to a tarball.
In the first case, using the image is very easy as it can be pulled directly
from the registry host using a 'docker pull' command. The main issue with this
method is the efficiency: images are not compressed and it takes ages to
transfer overlays to the client host.
In the second case, the efficiency is better but requires to transfer the image
archive manually. On the client host, loading the image is as simple as:
```
# wget -O - <archive_url> | docker load
```
### Instantiate a container
The following command located in contrib/ subdir can be used as **an example**
to instantiate a container:
```
# contrib/create_container 0
```
To instantiate more containers on the same host, the instance ID passed as an
argument must be different from the previous ones.
**PLEASE ADJUST THE SCRIPT create_container TO FIT YOUR ENVIRONMENT AND YOUR NEEDS**
|