-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from OpenCHAMI/alovelltroy/quickstart
Alovelltroy/quickstart
- Loading branch information
Showing
20 changed files
with
274 additions
and
207 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
|
||
## Build iPXE binaries from source | ||
FROM cgr.dev/chainguard/wolfi-base AS builder | ||
RUN apk add git gcc binutils make perl xz xz-dev build-base | ||
RUN mkdir -p /tmp | ||
WORKDIR /tmp | ||
RUN git clone https://github.com/ipxe/ipxe.git | ||
WORKDIR /tmp/ipxe/src/ | ||
RUN make bin/undionly.kpxe && \ | ||
make bin-x86_64-efi/ipxe.efi && \ | ||
cp -a bin/undionly.kpxe /tmp/ && \ | ||
cp -a bin-x86_64-efi/ipxe.efi /tmp/ | ||
|
||
## Build dnsmasq-dhcp container image | ||
FROM cgr.dev/chainguard/wolfi-base | ||
|
||
RUN apk add dnsmasq | ||
|
||
# Create the directory to store leases | ||
RUN mkdir -p /var/lib/misc | ||
|
||
# Create the directory to store the tftp files | ||
RUN mkdir -p /var/lib/tftpboot | ||
#Copy PXE files from builder stage | ||
COPY --from=builder /tmp/undionly.kpxe /var/lib/tftpboot/ | ||
COPY --from=builder /tmp/ipxe.efi /var/lib/tftpboot/ipxe-x86_64.efi | ||
|
||
VOLUME /etc/dnsmasq | ||
|
||
EXPOSE 53 53/udp | ||
EXPOSE 67 67/udp | ||
|
||
|
||
ENTRYPOINT ["dnsmasq", "-k", "--log-dhcp", "--log-facility=-", "-R", "-h", "-C", "/etc/dnsmasq/dnsmasq.conf" ] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
FROM cgr.dev/chainguard/python:latest-dev as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt . | ||
|
||
RUN pip install -r requirements.txt --user | ||
|
||
FROM cgr.dev/chainguard/python:latest | ||
|
||
WORKDIR /app | ||
|
||
# Make sure you update Python version in path | ||
COPY --from=builder /home/nonroot/.local/lib/python3.12/site-packages /home/nonroot/.local/lib/python3.12/site-packages | ||
|
||
COPY dnsmasq_updater.py . | ||
|
||
# Copy the rest of the application code | ||
COPY dnsmasq_updater.py . | ||
|
||
# Set the command to run your Python application | ||
ENTRYPOINT ["python", "/app/dnsmasq_updater.py"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Dynamic dnsmasq container | ||
|
||
This container expects all configuration files to be mounted in via docker volumes. | ||
|
||
See the [example directory](/examples/docker-compose/) for a recommended configuration file structure. | ||
|
||
## Dynamic hosts | ||
|
||
dnsmasq doesn't have a native facility to automatically update the configuration on changes. It requires a SIGHUP. However, it does have a facility that allows it to dynamically add hosts through the `--dhcp-hostsdir` option. The behavior may not be precisely what you expect. Here is the | ||
|
||
> --dhcp-hostsdir=<path> | ||
This is equivalent to --dhcp-hostsfile, except for the following. The path MUST be a directory, and not an individual file. Changed or new files within the directory are read automatically, without the need to send SIGHUP. If a file is deleted or changed after it has been read by dnsmasq, then the host record it contained will remain until dnsmasq receives a SIGHUP, or is restarted; ie host records are only added dynamically. The order in which the files in a directory are read is not defined. | ||
|
||
## Manually reloading the container configuration | ||
|
||
Docker supports sending signals to the main process in a container. From the [docker documentation](https://docs.docker.com/reference/cli/docker/container/kill/#send-a-custom-signal--to-a-container), there are several ways to send a SIGHUP to dnsmasq. | ||
|
||
```bash | ||
# The following commands are all equivalent | ||
docker kill --signal=SIGHUP dnsmasq | ||
docker kill --signal=HUP dnsmasq | ||
docker kill --signal=1 dnsmasq | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.