From 45cffd4b9e03fcb7fed739c3d47c458e2a5be8bb Mon Sep 17 00:00:00 2001 From: Christian Baer Date: Fri, 16 May 2025 00:19:15 +0200 Subject: [PATCH] First commit --- .env | 3 +++ .gitignore | 14 ++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ compose.yml | 14 ++++++++++++++ entrypoint.sh | 29 +++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100755 .env create mode 100755 .gitignore create mode 100755 Dockerfile create mode 100755 compose.yml create mode 100755 entrypoint.sh diff --git a/.env b/.env new file mode 100755 index 0000000..dd4d6a2 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +PUID=101 +PGID=101 +TZ=Etc/UTC diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..f250f68 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Compiled Python files +*.pyc + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..ae35732 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:bullseye-slim + +# Install NSD and required tools +RUN apt-get update && \ + apt-get install -y --no-install-recommends nsd tzdata && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Create necessary directories +RUN mkdir -p /var/lib/nsd /var/run/nsd /etc/nsd/conf.d + +# Copy entrypoint script +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Volume for configuration and data +VOLUME ["/etc/nsd", "/var/lib/nsd"] + +# Expose standard NSD port +EXPOSE 53/tcp 53/udp + +# Set start command +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100755 index 0000000..3735539 --- /dev/null +++ b/compose.yml @@ -0,0 +1,14 @@ +services: + nsd: + image: git.debilux.org/chris/docker-nsd + container_name: nsd + restart: unless-stopped + ports: + - "53:53/tcp" + - "53:53/udp" + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + volumes: + - ./config:/etc/nsd \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..bf93f7d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e + +# Default UID and GID if not specified +PUID=${PUID:-101} +PGID=${PGID:-101} +# Default timezone if not specified +TZ=${TZ:-Etc/UTC} + +# Set the timezone +ln -snf /usr/share/zoneinfo/$TZ /etc/localtime +echo "$TZ" >/etc/timezone +echo "Timezone set to $TZ" + +# Adjust GID for the nsd group +groupmod -o -g "$PGID" nsd +echo "GID for group nsd adjusted to $PGID" + +# Adjust UID for the nsd user +usermod -o -u "$PUID" nsd +echo "UID for user nsd adjusted to $PUID" + +# Set correct permissions +chown -R nsd:nsd /var/lib/nsd /var/run/nsd /etc/nsd +echo "Permissions adjusted" + +# Start NSD in the foreground with reduced warnings +echo "Starting NSD..." +exec nsd -d