Last active
June 26, 2024 01:36
-
-
Save xaker00/c0870549911b6eed626855396d93cf49 to your computer and use it in GitHub Desktop.
Dockerfile to build ipxe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:bookworm as builder | |
# parts borrowed from https://gist.github.com/rikka0w0/50895b82cbec8a3a1e8c7707479824c1 | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt update && \ | |
apt install --yes \ | |
git \ | |
gcc \ | |
make \ | |
liblzma-dev | |
RUN git clone https://github.com/ipxe/ipxe.git | |
WORKDIR /ipxe/src | |
# Enable NFS and extra tools support | |
RUN sed -i 's/#undef\tDOWNLOAD_PROTO_NFS/#define\tDOWNLOAD_PROTO_NFS/' config/general.h \ | |
&& sed -i 's/\/\/#define\ PING_CMD/#define\ PING_CMD/' config/general.h \ | |
&& sed -i 's/\/\/#define\ IPSTAT_CMD/#define\ IPSTAT_CMD/' config/general.h \ | |
&& sed -i 's/\/\/#define\ REBOOT_CMD/#define\ REBOOT_CMD/' config/general.h \ | |
&& sed -i 's/\/\/#define\ POWEROFF/#define\ POWEROFF/' config/general.h | |
COPY <<EOF /ipxe/src/embed.ipxe | |
#!ipxe | |
dhcp | |
chain tftp://${next-server}/main.ipxe || shell | |
EOF | |
RUN make -j4 bin/undionly.kpxe EMBED=embed.ipxe | |
RUN make -j4 bin-x86_64-efi/ipxe.efi | |
FROM scratch as output | |
COPY --from=builder /ipxe/src/bin/undionly.kpxe / | |
COPY --from=builder /ipxe/src/bin-x86_64-efi/ipxe.efi / | |
# Run using command | |
# docker build . --output ./artifacts --target output --platform linux/amd64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment