Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.28 #37

Merged
merged 6 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/action_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/action_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/action_schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ 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}"
echo "::set-output name=has_refs::1"
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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -180,15 +180,15 @@ 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

# -----------------------------------------------------------------------------------------------
# JOB (3/3): DEPLOY
# -----------------------------------------------------------------------------------------------
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
Expand Down Expand Up @@ -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}"
Expand All @@ -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 }}
9 changes: 8 additions & 1 deletion .github/workflows/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
]

Expand Down
43 changes: 43 additions & 0 deletions Dockerfiles/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -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"]
1 change: 1 addition & 0 deletions Dockerfiles/Dockerfile.latest
5 changes: 3 additions & 2 deletions Dockerfile → Dockerfiles/Dockerfile.stable
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM debian:stable-slim
LABEL org.opencontainers.image.authors="cytopia@everythingcli.org"

ENV \
USER=bind \
GROUP=bind

###
### Install
Expand All @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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


###
Expand Down Expand Up @@ -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}"


###
Expand Down Expand Up @@ -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
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ Bind caching DNS server based on Debian slim with support for DNS forwarders, in
|------------|------------------|
| <a href="https://hub.docker.com/r/cytopia/bind"><img height="82px" src="http://dockeri.co/image/cytopia/bind" /></a> | <a href="https://github.com/cytopia/devilbox" ><img height="82px" src="https://raw.githubusercontent.com/devilbox/artwork/master/submissions_banner/cytopia/01/png/banner_256_trans.png" /></a> |

## 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` |


----

Expand Down