-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (43 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
51 lines (43 loc) · 2.16 KB
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
# syntax=docker/dockerfile-upstream:1.5.0-rc2-labs
# This mkimage-raw-efi produces the raw EFI partition for EVE,
# including the files in efi-files in the image. This includes:
#
# /EFI/BOOT/grub.cfg - Chainloads main bootloader
# /UsbInvocationScript.txt - Enables USB boot on Dell 3000 series
#
FROM lfedge/eve-alpine:745ae9066273c73b0fd879c4ba4ff626a8392d04 AS build
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ENV BUILD_PKGS="grep patch git make gcc linux-headers musl-dev autoconf automake pkgconfig kmod-dev util-linux-dev cryptsetup-dev lddtree libgcc mkinitfs"
ENV PKGS="mtools dosfstools libarchive-tools sgdisk e2fsprogs util-linux squashfs-tools coreutils tar dmidecode \
kmod-libs cryptsetup-libs libblkid"
RUN eve-alpine-deploy.sh
# get mkinitfs source from git and build it locally
# it depends on mod-libs cryptsetup-libs libblkid at runtime and lddtree to run mkinitfs itself
# we could build APK file ourselves but 'apk add' would failed because networking is disabled for almost all linuxkit images
WORKDIR /tmp/mkinitfs
ADD https://github.com/alpinelinux/mkinitfs.git#3.8.1 /tmp/mkinitfs
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
WORKDIR /
RUN make -C /tmp/mkinitfs install
WORKDIR /out
RUN echo "mtools_skip_check=1" >> etc/mtools.conf
RUN mkdir -p efifs parts root bits config persist opt/pillar opt/debug lib/modules run sys
COPY make-raw UsbInvocationScript.txt ./
# bootstrap Alpine's initrd
WORKDIR /
COPY initramfs-init.patch /tmp/
RUN patch -p1 < /tmp/initramfs-init.patch
# from https://git.alpinelinux.org/aports/tree/main/mkinitfs/mkinitfs.post-install?id=7b64ec6e904040bd75ea21529b4fce61c908a553
# we need to simulate mkinitfs.post-install from the original APK file
# --- Quote ---
# safety. if nlplug-findfs is missing in the initramfs image we may end up
# with an unbootable system.
RUN if ! grep -q -w /sbin/nlplug-findfs /etc/mkinitfs/features.d/base.files; then \
echo "/sbin/nlplug-findfs" >> /etc/mkinitfs/features.d/base.files; \
fi
RUN echo /bin/grep >> /etc/mkinitfs/features.d/base.files
RUN mkinitfs -n -o /out/initrd.img
FROM scratch
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
COPY --from=build /out/ /
ENTRYPOINT [ "/make-raw" ]