Commit baa89d6
authored
Reduce number of layers and optimize build of the base-python images (#321)
* Bind-mount Python patches instead of copying them to the image
We don't need the patches in runtime but because they're copied, they are still
persisted in a layer of the image. Use bind-mount to have them available only
for the build.
* Create symlinks in the Python build step
There is no major benefit in splitting these two actions to two steps.
* Define PIP_VERSION arg once it's needed
By defining it early we're busting the cache on pip version upgrade,
effectively making the split into two layers pointless.
* Simplify pip install step using ensurepip
Use ensurepip instead of fetching get-pip to install pip, to make the build
step simpler. Note that --without-ensurepip in the Python configure args is
still desired and correct, as it only prevents from running ensurepip after the
build. The ensurepip and upgrade to the pinned version should be run in the
same step to prevent layer bloat by modified files.
* Use --default-pip instead of creating a symlink1 parent 8017f91 commit baa89d6
File tree
19 files changed
+30
-78
lines changed- python
- 3.12
- patches
- 3.13
- patches
- 3.14
- patches
19 files changed
+30
-78
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | 105 | | |
108 | | - | |
| 106 | + | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | 111 | | |
| 112 | + | |
| 113 | + | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
File renamed without changes.
File renamed without changes.
0 commit comments