feat(pxe): Add SPR
[csit.git] / fdio.infra.pxe / docker-dnsmasq / Dockerfile
1 FROM ubuntu:22.04 as ubuntu_jammy
2
3 LABEL Description="ubuntu intermediate image"
4 LABEL Version="2.0"
5
6 RUN apt update \
7  && apt install -y wget genisoimage syslinux-common \
8  && mkdir -p /var/lib/tftpboot/grub \
9  && mkdir -p /var/lib/tftpboot/grub/fonts \
10  && mkdir -p /var/lib/tftpboot/casper/ubuntu-jammy-amd64/ \
11  && mkdir -p /var/lib/tftpboot/casper/ubuntu-jammy-arm64/
12
13 ENV ISO_JAMMY_AMD64 https://old-releases.ubuntu.com/releases/22.04.1/ubuntu-22.04.1-live-server-amd64.iso
14 ENV ISO_JAMMY_ARM64 https://old-releases.ubuntu.com/releases/22.04.1/ubuntu-22.04.1-live-server-arm64.iso
15 ENV EFI_JAMMY_AMD64 http://archive.ubuntu.com/ubuntu/dists/jammy/main/uefi/grub2-amd64/current/grubnetx64.efi.signed
16 ENV EFI_JAMMY_ARM64 http://ports.ubuntu.com/ubuntu-ports/dists/jammy/main/uefi/grub2-arm64/current/grubnetaa64.efi.signed
17
18 RUN echo "Preparing Grub EFI Binary" \
19  && wget $EFI_JAMMY_AMD64 -O /var/lib/tftpboot/grubx64.efi \
20  && wget $EFI_JAMMY_ARM64 -O /var/lib/tftpboot/grubaa64.efi \
21  && apt download shim-signed \
22  && dpkg-deb --fsys-tarfile shim-signed*deb | tar x ./usr/lib/shim/shimx64.efi.signed.latest -O > /var/lib/tftpboot/bootx64.efi \
23  && apt download grub-common \
24  && dpkg-deb --fsys-tarfile grub-common*deb | tar x ./usr/share/grub/unicode.pf2 -O > /var/lib/tftpboot/grub/fonts/unicode.pf2
25
26 RUN echo "Preparing Casper Kernel" \
27  && wget $ISO_JAMMY_AMD64 -O /ubuntu-22.04.1-live-server-amd64.iso \
28  && isoinfo -i /ubuntu-22.04.1-live-server-amd64.iso -x "/CASPER/INITRD.;1" > /var/lib/tftpboot/casper/ubuntu-jammy-amd64/initrd \
29  && isoinfo -i /ubuntu-22.04.1-live-server-amd64.iso -x "/CASPER/VMLINUZ.;1" > /var/lib/tftpboot/casper/ubuntu-jammy-amd64/vmlinuz \
30  && wget $ISO_JAMMY_ARM64 -O /ubuntu-22.04.1-live-server-arm64.iso \
31  && isoinfo -i /ubuntu-22.04.1-live-server-arm64.iso -x "/CASPER/INITRD.;1" > /var/lib/tftpboot/casper/ubuntu-jammy-arm64/initrd \
32  && isoinfo -i /ubuntu-22.04.1-live-server-arm64.iso -x "/CASPER/VMLINUZ.;1" > /var/lib/tftpboot/casper/ubuntu-jammy-arm64/vmlinuz
33
34 FROM alpine
35
36 LABEL Description="dnsmasq service image"
37 LABEL Version="2.0"
38
39 RUN apk add --update --no-cache dnsmasq \
40  && rm -rf /var/cache/apk/*
41
42 # Extract installer from previous image.
43 COPY --from=ubuntu_jammy /var/lib/tftpboot /var/lib/tftpboot
44
45 # Configure PXE.
46 COPY tftpboot/ /var/lib/tftpboot/
47
48 # Configure DNSMASQ.
49 COPY etc/ /etc/
50
51 # Start dnsmasq. It picks up default configuration from /etc/dnsmasq.conf and
52 # /etc/default/dnsmasq plus any command line switch
53 ENTRYPOINT ["sh","-c","dnsmasq","--interface=$E_INT","--listen-address=$E_ADD"]