Files
metal/Dockerfile
2025-11-07 18:55:10 +01:00

41 lines
1.3 KiB
Docker

FROM docker.io/library/debian:stable AS builder-ipxe
RUN apt-get update \
&& apt-get install -y \
build-essential \
curl \
liblzma-dev \
genisoimage
ARG IPXE_VERSION=b41bda4413bf286d7b7a449bc05e1531da1eec2e
RUN curl -L https://github.com/ipxe/ipxe/archive/${IPXE_VERSION}.tar.gz | tar -xz
WORKDIR /ipxe-${IPXE_VERSION}/src
# Enable HTTPS
RUN sed -i 's/^#undef[\t ]DOWNLOAD_PROTO_HTTPS.*$/#define DOWNLOAD_PROTO_HTTPS/g' config/general.h
RUN mkdir /build
RUN make -j$(nproc) bin/ipxe.pxe && cp bin/ipxe.pxe /build
RUN make -j$(nproc) bin-x86_64-efi/ipxe.efi && cp bin-x86_64-efi/ipxe.efi /build
FROM docker.io/library/python:3.13-slim AS config-renderer
COPY --from=docker.io/hairyhenderson/gomplate:v4.3 /gomplate /bin/gomplate
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
COPY ./generate.sh /generate.sh
COPY ./tools /tools
COPY ./nodes /nodes
COPY ./templates /templates
RUN ./generate.sh
FROM docker.io/library/alpine:3.22.2 AS runtime
RUN apk add dnsmasq
COPY --from=builder-ipxe /build/ipxe.pxe /tftproot/
COPY --from=builder-ipxe /build/ipxe.efi /tftproot/
COPY --from=config-renderer /rendered/boot.ipxe /tftproot/
COPY --from=config-renderer /rendered/dnsmasq.conf /dnsmasq.conf
EXPOSE 67/udp
EXPOSE 69/udp
CMD ["dnsmasq", "--conf-file=/dnsmasq.conf", "--keep-in-foreground", "--user=root", "--log-facility=-", "--port=0"]