bootoci 0.2.1__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bootoci
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: Convert OCI images to bootable disk images
5
5
  Maintainer-email: Nadav Tasher <hey@nadav.app>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bootoci"
3
- version = "0.2.1"
3
+ version = "0.3.1"
4
4
  requires-python = ">= 3.8"
5
5
  description = "Convert OCI images to bootable disk images"
6
6
  readme = "README.md"
@@ -27,6 +27,7 @@ def parse_arguments():
27
27
  # Where does the kernel come from? Optional. Image can already have kernel.
28
28
  kernel_group = parser.add_mutually_exclusive_group(required=False)
29
29
  kernel_group.add_argument("--kernel-from-name", action="store", help="Use an existing kernel by name (e.g. 6.8.0-40-lowlatency)")
30
+ kernel_group.add_argument("--kernel-from-ubuntu", action="store_true", help="Use ubuntu's kernel")
30
31
  kernel_group.add_argument("--kernel-from-debian", action="store_true", help="Use debian's kernel")
31
32
  kernel_group.add_argument("--kernel-from-source", action="store_true", help="Build kernel from upstream source")
32
33
 
@@ -11,8 +11,9 @@ import jinja2
11
11
 
12
12
  # Get internal defaults
13
13
  INTERNAL_KERNEL_URL = os.environ.get("BOOTOCI_KERNEL_URL", "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.77.tar.xz")
14
+ INTERNAL_UBUNTU_IMAGE = os.environ.get("BOOTOCI_UBUNTU_IMAGE", "docker.io/library/ubuntu:24.04")
14
15
  INTERNAL_DEBIAN_IMAGE = os.environ.get("BOOTOCI_DEBIAN_IMAGE", "docker.io/library/debian:13-slim")
15
- INTERNAL_BUSYBOX_IMAGE = os.environ.get("BOOTOCI_DEBIAN_IMAGE", "docker.io/library/busybox:1.37.0-musl")
16
+ INTERNAL_BUSYBOX_IMAGE = os.environ.get("BOOTOCI_BUSYBOX_IMAGE", "docker.io/library/busybox:1.37.0-musl")
16
17
 
17
18
 
18
19
  def oci_to_bootable(
@@ -66,6 +67,9 @@ def oci_to_bootable(
66
67
  # Are we using a specific kernel that is already installed?
67
68
  kernel_from_name: Optional[str] = None,
68
69
 
70
+ # Are we using a kernel from ubuntu?
71
+ kernel_from_ubuntu: bool = False,
72
+
69
73
  # Are we using a kernel from debian?
70
74
  kernel_from_debian: bool = False,
71
75
 
@@ -83,6 +87,7 @@ def oci_to_bootable(
83
87
 
84
88
  # Internal options
85
89
  internal_kernel_url: str = INTERNAL_KERNEL_URL,
90
+ internal_ubuntu_image: str = INTERNAL_UBUNTU_IMAGE,
86
91
  internal_debian_image: str = INTERNAL_DEBIAN_IMAGE,
87
92
  internal_busybox_image: str = INTERNAL_BUSYBOX_IMAGE,
88
93
  ):
@@ -135,6 +140,7 @@ def oci_to_bootable(
135
140
 
136
141
  # Kernel source selection
137
142
  kernel_from_name=kernel_from_name,
143
+ kernel_from_ubuntu=kernel_from_ubuntu,
138
144
  kernel_from_debian=kernel_from_debian,
139
145
  kernel_from_source=kernel_from_source,
140
146
 
@@ -160,6 +166,7 @@ def oci_to_bootable(
160
166
 
161
167
  # Internal options
162
168
  internal_kernel_url=internal_kernel_url,
169
+ internal_ubuntu_image=internal_ubuntu_image,
163
170
  internal_debian_image=internal_debian_image,
164
171
  internal_busybox_image=internal_busybox_image,
165
172
  )
@@ -1,5 +1,3 @@
1
- # syntax=docker/dockerfile:1
2
-
3
1
  # Partition sizes
4
2
  {%- set bios_size = 1 %}
5
3
  {%- set efi_size = 256 %}
@@ -19,8 +17,8 @@ RUN <<'EOF'
19
17
  # Exit on failure
20
18
  set -ex
21
19
 
22
- apt update
23
- apt install --yes wget build-essential flex bison bc kmod libelf-dev libssl-dev
20
+ apt --option='Acquire::Check-Valid-Until=false' update
21
+ apt install --yes xz-utils build-essential flex bison bc kmod libelf-dev libssl-dev --no-install-suggests --no-install-recommends
24
22
  rm -r /var/lib/apt/lists
25
23
  EOF
26
24
 
@@ -28,7 +26,7 @@ EOF
28
26
  WORKDIR /downloads
29
27
 
30
28
  # Add the kernel sources archive
31
- RUN wget -O /downloads/linux.tar.xz "{{internal_kernel_url}}"
29
+ ADD "{{internal_kernel_url}}" /downloads/linux.tar.xz
32
30
 
33
31
  # Change to build workdir
34
32
  WORKDIR /build/linux
@@ -64,8 +62,22 @@ RUN <<'EOF'
64
62
  # Exit on failure
65
63
  set -e
66
64
 
67
- apt update
68
- apt install --yes linux-image-amd64
65
+ apt --option='Acquire::Check-Valid-Until=false' update
66
+ apt install --yes linux-image-amd64 --no-install-suggests --no-install-recommends
67
+ rm -r /var/lib/apt/lists
68
+ EOF
69
+ {% endif %}
70
+
71
+ {% if kernel_from_ubuntu %}
72
+ FROM {{internal_ubuntu_image}} AS kernel-from-ubuntu
73
+
74
+ # Download the latest linux image
75
+ RUN <<'EOF'
76
+ # Exit on failure
77
+ set -e
78
+
79
+ apt --option='Acquire::Check-Valid-Until=false' update
80
+ apt install --yes linux-image-generic --no-install-suggests --no-install-recommends
69
81
  rm -r /var/lib/apt/lists
70
82
  EOF
71
83
  {% endif %}
@@ -88,6 +100,12 @@ COPY --from=kernel-from-debian /boot /boot
88
100
  COPY --from=kernel-from-debian /lib/modules /lib/modules
89
101
  {% endif %}
90
102
 
103
+ {% if kernel_from_ubuntu %}
104
+ # Install kernel artifacts from fetch stage
105
+ COPY --from=kernel-from-ubuntu /boot /boot
106
+ COPY --from=kernel-from-ubuntu /lib/modules /lib/modules
107
+ {% endif %}
108
+
91
109
  {% if rootfs_password %}
92
110
  {% for password in rootfs_password %}
93
111
  # Use busybox from external image to change password
@@ -153,11 +171,13 @@ set -e
153
171
  # Enter original working directory
154
172
  cd -P /bootoci/workdir
155
173
 
174
+ {% if Env %}
156
175
  # Add environment variables
157
176
  export {{Env | join(" ")}}
177
+ {% endif %}
158
178
 
159
179
  # Execute entrypoint with cmd
160
- {{Entrypoint | join(" ")}} {{Cmd | join(" ")}}
180
+ exec {{((Entrypoint or []) + (Cmd or [])) | join(" ")}}
161
181
  EOF
162
182
  {% endif %}
163
183
 
@@ -193,8 +213,8 @@ RUN <<'EOF'
193
213
  # Exit on failure
194
214
  set -e
195
215
 
196
- apt update
197
- apt install --yes gdisk dracut e2fsprogs mtools dosfstools grub-efi-amd64-bin grub-efi-amd64-signed qemu-utils
216
+ apt --option='Acquire::Check-Valid-Until=false' update
217
+ apt install --yes gdisk dracut e2fsprogs mtools dosfstools grub-efi-amd64-bin grub-efi-amd64-signed qemu-utils --no-install-suggests --no-install-recommends
198
218
  rm -r /var/lib/apt/lists
199
219
  EOF
200
220
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bootoci
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: Convert OCI images to bootable disk images
5
5
  Maintainer-email: Nadav Tasher <hey@nadav.app>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes