2026-02-17 16:16:01 +13:00
|
|
|
FROM python:3.11.12-slim
|
|
|
|
|
|
2026-02-20 06:29:39 +13:00
|
|
|
# Install system dependencies.
|
|
|
|
|
# Both NSD and BIND are installed so the image works with any DNS backend type.
|
|
|
|
|
# The entrypoint detects which one is configured and starts only that daemon.
|
|
|
|
|
# CoreDNS MySQL users: neither daemon is started — the image is still usable.
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2026-02-17 16:16:01 +13:00
|
|
|
bind9 \
|
|
|
|
|
bind9utils \
|
2026-02-20 06:29:39 +13:00
|
|
|
nsd \
|
2026-02-17 16:16:01 +13:00
|
|
|
dnsutils \
|
|
|
|
|
gcc \
|
|
|
|
|
python3-dev \
|
|
|
|
|
default-libmysqlclient-dev \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-02-20 06:29:39 +13:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# BIND setup
|
|
|
|
|
# ---------------------------------------------------------------------------
|
2026-02-17 16:16:01 +13:00
|
|
|
RUN mkdir -p /etc/named/zones && \
|
|
|
|
|
chown -R bind:bind /etc/named && \
|
|
|
|
|
chmod 755 /etc/named/zones
|
|
|
|
|
|
|
|
|
|
COPY docker/named.conf.local /etc/bind/
|
|
|
|
|
COPY docker/named.conf.options /etc/bind/
|
|
|
|
|
RUN chown root:bind /etc/bind/named.conf.*
|
|
|
|
|
|
2026-02-20 06:29:39 +13:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# NSD setup
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
RUN mkdir -p /etc/nsd/zones /etc/nsd/nsd.conf.d && \
|
|
|
|
|
chown -R nsd:nsd /etc/nsd && \
|
|
|
|
|
chmod 755 /etc/nsd/zones
|
|
|
|
|
|
|
|
|
|
COPY docker/nsd.conf /etc/nsd/nsd.conf
|
|
|
|
|
RUN chown nsd:nsd /etc/nsd/nsd.conf
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Application
|
|
|
|
|
# ---------------------------------------------------------------------------
|
2026-02-17 16:16:01 +13:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY pyproject.toml poetry.lock README.md ./
|
|
|
|
|
|
2026-02-20 06:29:39 +13:00
|
|
|
RUN pip install "poetry==2.1.2"
|
2026-02-17 16:16:01 +13:00
|
|
|
|
|
|
|
|
COPY directdnsonly ./directdnsonly
|
|
|
|
|
COPY schema ./schema
|
|
|
|
|
|
|
|
|
|
RUN poetry config virtualenvs.create false && \
|
|
|
|
|
poetry install
|
|
|
|
|
|
|
|
|
|
# Create data directories
|
2026-02-20 06:29:39 +13:00
|
|
|
RUN mkdir -p /app/data/queues /app/data/zones /app/logs && \
|
2026-02-17 16:16:01 +13:00
|
|
|
chmod -R 755 /app/data
|
|
|
|
|
|
|
|
|
|
# Start script
|
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
|
|
EXPOSE 2222 53/udp
|
2026-02-20 06:29:39 +13:00
|
|
|
CMD ["/entrypoint.sh"]
|