diff --git a/.github/workflows/action_branch.yml b/.github/workflows/action_branch.yml
index 9139bd9..9f205aa 100644
--- a/.github/workflows/action_branch.yml
+++ b/.github/workflows/action_branch.yml
@@ -22,8 +22,8 @@ jobs:
# (2/2) Build
docker:
needs: [params]
- #uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
- uses: ./.github/workflows/docker-name-version-arch.yml
+ #uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
+ uses: ./.github/workflows/docker-name-version-flavour-arch.yml
with:
enabled: true
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
diff --git a/.github/workflows/action_pull_request.yml b/.github/workflows/action_pull_request.yml
index 8d86e44..cfad24f 100644
--- a/.github/workflows/action_pull_request.yml
+++ b/.github/workflows/action_pull_request.yml
@@ -24,8 +24,8 @@ jobs:
# (2/2) Build
docker:
needs: [params]
- #uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
- uses: ./.github/workflows/docker-name-version-arch.yml
+ #uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
+ uses: ./.github/workflows/docker-name-version-flavour-arch.yml
with:
enabled: true
can_deploy: false
diff --git a/.github/workflows/action_schedule.yml b/.github/workflows/action_schedule.yml
index d2b8c1e..c61e6b1 100644
--- a/.github/workflows/action_schedule.yml
+++ b/.github/workflows/action_schedule.yml
@@ -24,8 +24,8 @@ jobs:
# (2/2) Build
docker:
needs: [params]
- #uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
- uses: ./.github/workflows/docker-name-version-arch.yml
+ #uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
+ uses: ./.github/workflows/docker-name-version-flavour-arch.yml
with:
enabled: true
can_deploy: true
diff --git a/.github/workflows/docker-name-version-arch.yml b/.github/workflows/docker-name-version-flavour-arch.yml
similarity index 86%
rename from .github/workflows/docker-name-version-arch.yml
rename to .github/workflows/docker-name-version-flavour-arch.yml
index 3eafa82..e117425 100644
--- a/.github/workflows/docker-name-version-arch.yml
+++ b/.github/workflows/docker-name-version-flavour-arch.yml
@@ -69,12 +69,12 @@ jobs:
MATRIX_BUILD="$( \
jq -M -c \
--argjson refs '${{ inputs.refs }}' \
- 'map({name:.NAME, version:.VERSION[], arch:.ARCH[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
+ 'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
)"
MATRIX_DEPLOY="$( \
jq -M -c \
--argjson refs '${{ inputs.refs }}' \
- 'map({name:.NAME, version:.VERSION[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
+ 'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
)"
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
@@ -82,11 +82,11 @@ jobs:
else
MATRIX_BUILD="$( \
jq -M -c \
- 'map({name:.NAME, version:.VERSION[], arch:.ARCH[]})' <<<'${{ inputs.matrix }}' \
+ 'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[]})' <<<'${{ inputs.matrix }}' \
)"
MATRIX_DEPLOY="$( \
jq -M -c \
- 'map({name:.NAME, version:.VERSION[]})' <<<'${{ inputs.matrix }}' \
+ 'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[]})' <<<'${{ inputs.matrix }}' \
)"
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
@@ -114,7 +114,7 @@ jobs:
# -----------------------------------------------------------------------------------------------
build:
needs: [configure]
- name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.arch }}) ${{ matrix.refs }}
+ name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -155,7 +155,7 @@ jobs:
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
- make build NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
+ make build NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Test
@@ -164,7 +164,7 @@ jobs:
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
- make test NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
+ make test NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Deploy
@@ -180,7 +180,7 @@ jobs:
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
- make push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
+ make push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
if: needs.configure.outputs.can_login == 1 && inputs.can_deploy
# -----------------------------------------------------------------------------------------------
@@ -188,7 +188,7 @@ jobs:
# -----------------------------------------------------------------------------------------------
deploy:
needs: [configure, build]
- name: Deploy ${{ matrix.name }}-${{ matrix.version }} ${{ matrix.refs }}
+ name: Deploy ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -221,8 +221,8 @@ jobs:
run: |
ARCHES="$( echo '${{ inputs.matrix }}' \
| jq 'group_by(.NAME, .VERSION, .ARCH)' \
- | jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], ARCHES: .[].ARCH|join(",")})' \
- | jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}") | .ARCHES' \
+ | jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], FLAVOUR: .[].FLAVOUR[], ARCHES: .[].ARCH|join(",")})' \
+ | jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}" and .FLAVOUR=="${{ matrix.flavour }}") | .ARCHES' \
| jq -c -M \
)"
echo "::set-output name=arches::${ARCHES}"
@@ -242,10 +242,10 @@ jobs:
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
- make manifest-create NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
+ make manifest-create NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[DEPLOY] Publish Docker manifest: ${{ steps.tag.outputs.docker-tag }}"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
- make manifest-push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} TAG=${{ steps.tag.outputs.docker-tag }}
+ make manifest-push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} TAG=${{ steps.tag.outputs.docker-tag }}
diff --git a/.github/workflows/params.yml b/.github/workflows/params.yml
index b2820bc..a292b09 100644
--- a/.github/workflows/params.yml
+++ b/.github/workflows/params.yml
@@ -14,8 +14,15 @@ env:
[
{
"NAME": "Bind",
- "VERSION": ["latest"],
+ "VERSION": ["9"],
+ "FLAVOUR": ["stable", "latest"],
"ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x", "linux/mips64le"]
+ },
+ {
+ "NAME": "Bind",
+ "VERSION": ["9"],
+ "FLAVOUR": ["alpine"],
+ "ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x"]
}
]
diff --git a/Dockerfiles/Dockerfile.alpine b/Dockerfiles/Dockerfile.alpine
new file mode 100644
index 0000000..88f8b9b
--- /dev/null
+++ b/Dockerfiles/Dockerfile.alpine
@@ -0,0 +1,43 @@
+FROM alpine
+LABEL org.opencontainers.image.authors="cytopia@everythingcli.org"
+
+ENV \
+ USER=named \
+ GROUP=named
+
+###
+### Install
+###
+RUN set -x \
+ && apk add --no-cache \
+ bash \
+ bind \
+ bind-tools \
+ # Log directory
+ && mkdir /var/log/named \
+ && chown ${USER}:${GROUP} /var/log/named \
+ && chmod 0755 /var/log/named \
+ # Cache directory
+ && mkdir /var/cache/bind \
+ && chown root:${GROUP} /var/cache/bind \
+ && chmod 0775 /var/cache/bind
+
+
+
+###
+### Bootstrap Scipts
+###
+COPY ./data/docker-entrypoint.sh /
+
+
+###
+### Ports
+###
+EXPOSE 53
+EXPOSE 53/udp
+
+
+####
+#### Entrypoint
+####
+ENTRYPOINT ["/docker-entrypoint.sh"]
diff --git a/Dockerfiles/Dockerfile.latest b/Dockerfiles/Dockerfile.latest
new file mode 120000
index 0000000..f924cbb
--- /dev/null
+++ b/Dockerfiles/Dockerfile.latest
@@ -0,0 +1 @@
+Dockerfile.stable
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfiles/Dockerfile.stable
similarity index 95%
rename from Dockerfile
rename to Dockerfiles/Dockerfile.stable
index 387c900..e2e38b6 100644
--- a/Dockerfile
+++ b/Dockerfiles/Dockerfile.stable
@@ -1,6 +1,9 @@
FROM debian:stable-slim
LABEL org.opencontainers.image.authors="cytopia@everythingcli.org"
+ENV \
+ USER=bind \
+ GROUP=bind
###
### Install
@@ -9,8 +12,6 @@ RUN set -eux \
&& apt update \
&& apt install --no-install-recommends --no-install-suggests -y \
bind9 \
- #nsutils \
- #putils-ping \
&& apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -r /var/lib/apt/lists/* \
&& mkdir /var/log/named \
diff --git a/data/docker-entrypoint.sh b/Dockerfiles/data/docker-entrypoint.sh
similarity index 97%
rename from data/docker-entrypoint.sh
rename to Dockerfiles/data/docker-entrypoint.sh
index 0020fc3..64f1da1 100755
--- a/data/docker-entrypoint.sh
+++ b/Dockerfiles/data/docker-entrypoint.sh
@@ -27,6 +27,13 @@ NAMED_LOG_CONF="${NAMED_DIR}/named.conf.logging"
NAMED_CUST_CONF="${NAMED_DIR}/custom/conf"
NAMED_CUST_ZONE="${NAMED_DIR}/custom/zone"
+# Recreate custom config directories
+if [ -d "${NAMED_CUST_CONF}" ]; then
+ rm -rf "${NAMED_CUST_CONF}"
+fi
+if [ -d "${NAMED_CUST_ZONE}" ]; then
+ rm -rf "${NAMED_CUST_ZONE}"
+fi
mkdir -p "${NAMED_CUST_CONF}"
mkdir -p "${NAMED_CUST_ZONE}"
@@ -37,7 +44,13 @@ mkdir -p "${NAMED_CUST_ZONE}"
### When overwriting, use an FQDN by which this container is reachable.
### http://rscott.org/dns/soa.html
###
-DEFAULT_MNAME="$( hostname -A | sed 's/\s$//g' | xargs -0 )"
+if [ -f "/etc/alpine-release" ]; then
+ # Alpine
+ DEFAULT_MNAME="$( hostname -f | sed 's/\s$//g' | xargs -0 )"
+else
+ # Debian
+ DEFAULT_MNAME="$( hostname -A | sed 's/\s$//g' | xargs -0 )"
+fi
###
@@ -532,10 +545,14 @@ log "info" "Debug level: ${DEBUG_ENTRYPOINT}" "${DEBUG_ENTRYPOINT}"
{
echo "include \"${NAMED_LOG_CONF}\";"
echo "include \"${NAMED_OPT_CONF}\";"
- echo "include \"/etc/bind/named.conf.local\";"
- echo "include \"/etc/bind/named.conf.default-zones\";"
+ if [ -f "/etc/bind/named.conf.local" ]; then
+ echo "include \"/etc/bind/named.conf.local\";"
+ fi
+ if [ -f "/etc/bind/named.conf.default-zones" ]; then
+ echo "include \"/etc/bind/named.conf.default-zones\";"
+ fi
} > "${NAMED_CONF}"
-
+log_file "${NAMED_CONF}"
###
@@ -917,4 +934,4 @@ done <<< "${FWD_ZONES}"
###
log "info" "Starting $( named -V | grep -oiE '^BIND[[:space:]]+[0-9.]+' )" "${DEBUG_ENTRYPOINT}"
named-checkconf "${NAMED_CONF}"
-exec /usr/sbin/named -4 -c /etc/bind/named.conf -u bind -f
+exec /usr/sbin/named -4 -c /etc/bind/named.conf -u "${USER}" -f
diff --git a/Makefile b/Makefile
index 2f88ec4..758045a 100644
--- a/Makefile
+++ b/Makefile
@@ -27,9 +27,18 @@ TAG = latest
NAME = Bind
VERSION = latest
IMAGE = cytopia/bind
-DIR = .
-FILE = Dockerfile
-DOCKER_TAG = $(TAG)
+FLAVOUR = latest
+DIR = Dockerfiles
+FILE = Dockerfile.$(FLAVOUR)
+ifeq ($(strip $(FLAVOUR)),latest)
+ DOCKER_TAG = $(TAG)
+else
+ ifeq ($(strip $(TAG)),latest)
+ DOCKER_TAG = $(FLAVOUR)
+ else
+ DOCKER_TAG = $(FLAVOUR)-$(TAG)
+ endif
+endif
ARCH = linux/amd64
# Makefile.lint overwrites
diff --git a/README.md b/README.md
index b63932d..3eec60a 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,22 @@ Bind caching DNS server based on Debian slim with support for DNS forwarders, in
|------------|------------------|
|
|
|
+## Available Docker tags
+
+| Docker Tag | Description |
+|--------------------------------|--------------------------------------------------------------|
+| `latest` | Latest Debian stable image (default) |
+| `stable` | Latest Debian stable image |
+| `alpine` | Latest Alpine image |
+| | |
+| `[0-9]\.[0-9]+` | Git tagged Debian stable image. E.g: `0.53` |
+| `stable-[0-9]\.[0-9]+` | Git tagged Debian stable image. E.g: `stable-0.53` |
+| `alpine-[0-9]\.[0-9]+` | Git tagged Alpine image. E.g: `alpine-0.53` |
+| | |
+| `release-[0-9]\.[0-9]+` | Git branch Debian stable image. E.g: `release-0.53` |
+| `stable-release-[0-9]\.[0-9]+` | Git branch Debian stable image. E.g: `stable-release-0.53` |
+| `alpine-release-[0-9]\.[0-9]+` | Git branch Alpine image. E.g: `alpine-release-0.53` |
+
----