blob: 8ca423b5d2ddaddb818f11e14ac39b0e748f021b [file] [log] [blame]
vexxhost-bot8c2b6d32024-06-04 17:31:00 +02001======
2Images
3======
4
5*************
6Build Process
7*************
8
9This section provides an overview of how the container images used by Atmosphere
10are built. Understanding this process is crucial for maintaining and customizing
11the images for your specific needs.
12
13Multi-Stage Builds
14==================
15
16The images are built using a multi-stage build process. This means that all
17build-time dependencies are included only in the intermediate stages and are not
18present in the final runtime images.
19
20Benefits
21--------
22
23The multi-stage build process offers several benefits which improve the
24efficiency, security, and performance of the images.
25
26Smaller Image Size
27^^^^^^^^^^^^^^^^^^
28
29By excluding build-time dependencies, the final images are significantly
30smaller. This reduction in size offers several advantages.
31
32First, it leads to more efficient storage usage, as smaller images consume less
33disk space, making it easier to manage and store multiple images. Additionally,
34the reduced image size results in faster download times when pulling images from
35a container registry, thereby speeding up deployment times.
36
37Furthermore, smaller images require less network bandwidth, which can be beneficial
38in environments with limited network resources.
39
40Enhanced Security
41^^^^^^^^^^^^^^^^^
42
43Reducing the number of packages and dependencies in the final image decreases
44the attack surface, thereby enhancing security. With only essential runtime
45dependencies included, the opportunities for attackers to exploit
46vulnerabilities are significantly reduced, leading to minimized exposure.
47
48Moreover, a smaller set of packages simplifies auditing, making it easier to
49ensure that all components are secure and up-to-date. Additionally, fewer
50dependencies mean fewer updates and patches, which simplifies the maintenance
51process and reduces the risk of introducing new vulnerabilities.
52
53Improved Performance
54^^^^^^^^^^^^^^^^^^^^
55
56Smaller images lead to faster deployment times and lower resource consumption,
57which improves overall system performance. Containers based on smaller images
58start up more quickly, enhancing the responsiveness of applications and services.
59
60Reduced resource consumption translates to lower memory and CPU usage, allowing
61more efficient utilization of system resources. Furthermore, faster deployment
62and efficient resource use enable better scalability, allowing the system to
63handle increased loads more effectively.
64
65Example
66-------
67
68The ``openstack-venv-builder`` image is used to build a virtual environment with
69all of the Python dependencies required by the OpenStack services. It also
70contains a modified version of the ``upper-constraints.txt`` file, which has
71many of the dependencies pinned to specific versions and modified to avoid
72security vulnerabilities.
73
74.. literalinclude:: ../../../images/openstack-venv-builder/Dockerfile
75 :language: dockerfile
76 :caption: ``images/openstack-venv-builder/Dockerfile``
77
78In addition to that image, the ``openstack-python-runtime`` image is a stripped
79down base image as a run-time for OpenStack services with no installed
80packages than the base Ubuntu image.
81
82.. literalinclude:: ../../../images/openstack-runtime/Dockerfile
83 :language: dockerfile
84 :caption: ``images/openstack-runtime/Dockerfile``
85
86With the ``openstack-venv-builder`` & ``openstack-python-runtime`` the image for
87a project such as OpenStack Nova can be built using the following Dockerfile.
88
89This Dockerfile uses the ``openstack-venv-builder`` image to build the virtual
90environment and then copies the virtual environment into the final image based
91on the ``openstack-python-runtime`` image. With this, it has no other build-time
92dependencies and only the runtime dependencies required for the OpenStack Nova
93service.
94
95.. literalinclude:: ../../../images/nova/Dockerfile
96 :language: dockerfile
97 :caption: ``images/nova/Dockerfile``