aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.pxe/docker-dnsmasq/Dockerfile
blob: 4d6cb9c9f9b55a008108ee33585378f4209575b2 (plain)
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
52
53
54
55
FROM ubuntu:20.04 as ubuntu_focal

LABEL Description="ubuntu intermediate image"
LABEL Version="2.0"

RUN apt update \
 && apt install -y wget genisoimage syslinux-common \
 && mkdir -p /var/lib/tftpboot/grub \
 && mkdir -p /var/lib/tftpboot/casper/ubuntu-focal-amd64/ \
 && mkdir -p /var/lib/tftpboot/casper/ubuntu-focal-arm64/ \
 && mkdir -p /var/lib/tftpboot/casper/ubuntu-bionic-amd64/

ENV ISO_FOCAL_AMD64 https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-live-server-amd64.iso
ENV ISO_FOCAL_ARM64 https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso
ENV ISO_BIONIC_AMD64 https://releases.ubuntu.com/18.04.5/ubuntu-18.04.5-live-server-amd64.iso
ENV EFI_FOCAL_AMD64 http://archive.ubuntu.com/ubuntu/dists/focal/main/uefi/grub2-amd64/current/grubnetx64.efi.signed
ENV EFI_FOCAL_ARM64 http://ports.ubuntu.com/ubuntu-ports/dists/focal/main/uefi/grub2-arm64/current/grubnetaa64.efi.signed
ENV EFI_BIONIC_AMD64 http://archive.ubuntu.com/ubuntu/dists/bionic/main/uefi/grub2-amd64/current/grubnetx64.efi.signed

RUN echo "Preparing Grub EFI Binary" \
 && wget $EFI_BIONIC_AMD64 -O /var/lib/tftpboot/grub/grubnetx64.efi.signed \
 && wget $EFI_FOCAL_ARM64 -O /var/lib/tftpboot/grub/grubnetaa64.efi.signed

RUN echo "Preparing Casper Kernel" \
 && wget $ISO_FOCAL_AMD64 -O /ubuntu-20.04.3-live-server-amd64.iso \
 && isoinfo -i /ubuntu-20.04.3-live-server-amd64.iso -x "/CASPER/INITRD.;1" > /var/lib/tftpboot/casper/ubuntu-focal-amd64/initrd \
 && isoinfo -i /ubuntu-20.04.3-live-server-amd64.iso -x "/CASPER/VMLINUZ.;1" > /var/lib/tftpboot/casper/ubuntu-focal-amd64/vmlinuz\
 && wget $ISO_FOCAL_ARM64 -O /ubuntu-20.04.3-live-server-arm64.iso \
 && isoinfo -i /ubuntu-20.04.3-live-server-arm64.iso -x "/CASPER/INITRD.;1" > /var/lib/tftpboot/casper/ubuntu-focal-arm64/initrd \
 && isoinfo -i /ubuntu-20.04.3-live-server-arm64.iso -x "/CASPER/VMLINUZ.;1" > /var/lib/tftpboot/casper/ubuntu-focal-arm64/vmlinuz \
 && wget $ISO_BIONIC_AMD64 -O /ubuntu-18.04.5-live-server-amd64.iso \
 && isoinfo -i /ubuntu-18.04.5-live-server-amd64.iso -x "/CASPER/INITRD.;1" > /var/lib/tftpboot/casper/ubuntu-bionic-amd64/initrd \
 && isoinfo -i /ubuntu-18.04.5-live-server-amd64.iso -x "/CASPER/VMLINUZ.;1" > /var/lib/tftpboot/casper/ubuntu-bionic-amd64/vmlinuz


FROM alpine

LABEL Description="dnsmasq service image"
LABEL Version="2.0"

RUN apk add --update --no-cache dnsmasq \
 && rm -rf /var/cache/apk/*

# Extract installer from previous image.
COPY --from=ubuntu_focal /var/lib/tftpboot /var/lib/tftpboot

# Configure PXE.
COPY tftpboot/ /var/lib/tftpboot/

# Configure DNSMASQ.
COPY etc/ /etc/

# Start dnsmasq. It picks up default configuration from /etc/dnsmasq.conf and
# /etc/default/dnsmasq plus any command line switch
ENTRYPOINT ["sh","-c","dnsmasq","--interface=$E_INT","--listen-address=$E_ADD"]