Skip to content

Commit ef955ca

Browse files
authored
Merge pull request #37 from cytopia/release-0.28
Release 0.28
2 parents 7f1ec20 + 65238b6 commit ef955ca

11 files changed

Lines changed: 124 additions & 30 deletions

.github/workflows/action_branch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
# (2/2) Build
2323
docker:
2424
needs: [params]
25-
#uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
26-
uses: ./.github/workflows/docker-name-version-arch.yml
25+
#uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
26+
uses: ./.github/workflows/docker-name-version-flavour-arch.yml
2727
with:
2828
enabled: true
2929
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}

.github/workflows/action_pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
# (2/2) Build
2525
docker:
2626
needs: [params]
27-
#uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
28-
uses: ./.github/workflows/docker-name-version-arch.yml
27+
#uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
28+
uses: ./.github/workflows/docker-name-version-flavour-arch.yml
2929
with:
3030
enabled: true
3131
can_deploy: false

.github/workflows/action_schedule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
# (2/2) Build
2525
docker:
2626
needs: [params]
27-
#uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
28-
uses: ./.github/workflows/docker-name-version-arch.yml
27+
#uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
28+
uses: ./.github/workflows/docker-name-version-flavour-arch.yml
2929
with:
3030
enabled: true
3131
can_deploy: true

.github/workflows/docker-name-version-arch.yml renamed to .github/workflows/docker-name-version-flavour-arch.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,24 @@ jobs:
6969
MATRIX_BUILD="$( \
7070
jq -M -c \
7171
--argjson refs '${{ inputs.refs }}' \
72-
'map({name:.NAME, version:.VERSION[], arch:.ARCH[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
72+
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
7373
)"
7474
MATRIX_DEPLOY="$( \
7575
jq -M -c \
7676
--argjson refs '${{ inputs.refs }}' \
77-
'map({name:.NAME, version:.VERSION[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
77+
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
7878
)"
7979
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
8080
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
8181
echo "::set-output name=has_refs::1"
8282
else
8383
MATRIX_BUILD="$( \
8484
jq -M -c \
85-
'map({name:.NAME, version:.VERSION[], arch:.ARCH[]})' <<<'${{ inputs.matrix }}' \
85+
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[]})' <<<'${{ inputs.matrix }}' \
8686
)"
8787
MATRIX_DEPLOY="$( \
8888
jq -M -c \
89-
'map({name:.NAME, version:.VERSION[]})' <<<'${{ inputs.matrix }}' \
89+
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[]})' <<<'${{ inputs.matrix }}' \
9090
)"
9191
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
9292
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
@@ -114,7 +114,7 @@ jobs:
114114
# -----------------------------------------------------------------------------------------------
115115
build:
116116
needs: [configure]
117-
name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.arch }}) ${{ matrix.refs }}
117+
name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) (${{ matrix.arch }}) ${{ matrix.refs }}
118118
runs-on: ubuntu-latest
119119
strategy:
120120
fail-fast: false
@@ -155,7 +155,7 @@ jobs:
155155
uses: cytopia/shell-command-retry-action@v0.1.2
156156
with:
157157
command: |
158-
make build NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
158+
make build NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
159159
160160
# ------------------------------------------------------------
161161
# Test
@@ -164,7 +164,7 @@ jobs:
164164
uses: cytopia/shell-command-retry-action@v0.1.2
165165
with:
166166
command: |
167-
make test NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
167+
make test NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
168168
169169
# ------------------------------------------------------------
170170
# Deploy
@@ -180,15 +180,15 @@ jobs:
180180
uses: cytopia/shell-command-retry-action@v0.1.2
181181
with:
182182
command: |
183-
make push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
183+
make push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
184184
if: needs.configure.outputs.can_login == 1 && inputs.can_deploy
185185

186186
# -----------------------------------------------------------------------------------------------
187187
# JOB (3/3): DEPLOY
188188
# -----------------------------------------------------------------------------------------------
189189
deploy:
190190
needs: [configure, build]
191-
name: Deploy ${{ matrix.name }}-${{ matrix.version }} ${{ matrix.refs }}
191+
name: Deploy ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) ${{ matrix.refs }}
192192
runs-on: ubuntu-latest
193193
strategy:
194194
fail-fast: false
@@ -221,8 +221,8 @@ jobs:
221221
run: |
222222
ARCHES="$( echo '${{ inputs.matrix }}' \
223223
| jq 'group_by(.NAME, .VERSION, .ARCH)' \
224-
| jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], ARCHES: .[].ARCH|join(",")})' \
225-
| jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}") | .ARCHES' \
224+
| jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], FLAVOUR: .[].FLAVOUR[], ARCHES: .[].ARCH|join(",")})' \
225+
| jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}" and .FLAVOUR=="${{ matrix.flavour }}") | .ARCHES' \
226226
| jq -c -M \
227227
)"
228228
echo "::set-output name=arches::${ARCHES}"
@@ -242,10 +242,10 @@ jobs:
242242
uses: cytopia/shell-command-retry-action@v0.1.2
243243
with:
244244
command: |
245-
make manifest-create NAME=${{ matrix.name }} VERSION=${{ matrix.version }} ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
245+
make manifest-create NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
246246
247247
- name: "[DEPLOY] Publish Docker manifest: ${{ steps.tag.outputs.docker-tag }}"
248248
uses: cytopia/shell-command-retry-action@v0.1.2
249249
with:
250250
command: |
251-
make manifest-push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} TAG=${{ steps.tag.outputs.docker-tag }}
251+
make manifest-push NAME=${{ matrix.name }} VERSION=${{ matrix.version }} FLAVOUR=${{ matrix.flavour }} TAG=${{ steps.tag.outputs.docker-tag }}

.github/workflows/params.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ env:
1414
[
1515
{
1616
"NAME": "Bind",
17-
"VERSION": ["latest"],
17+
"VERSION": ["9"],
18+
"FLAVOUR": ["stable", "latest"],
1819
"ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x", "linux/mips64le"]
20+
},
21+
{
22+
"NAME": "Bind",
23+
"VERSION": ["9"],
24+
"FLAVOUR": ["alpine"],
25+
"ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x"]
1926
}
2027
]
2128

Dockerfiles/Dockerfile.alpine

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM alpine
2+
LABEL org.opencontainers.image.authors="cytopia@everythingcli.org"
3+
4+
ENV \
5+
USER=named \
6+
GROUP=named
7+
8+
###
9+
### Install
10+
###
11+
RUN set -x \
12+
&& apk add --no-cache \
13+
bash \
14+
bind \
15+
bind-tools \
16+
# Log directory
17+
&& mkdir /var/log/named \
18+
&& chown ${USER}:${GROUP} /var/log/named \
19+
&& chmod 0755 /var/log/named \
20+
# Cache directory
21+
&& mkdir /var/cache/bind \
22+
&& chown root:${GROUP} /var/cache/bind \
23+
&& chmod 0775 /var/cache/bind
24+
25+
26+
27+
###
28+
### Bootstrap Scipts
29+
###
30+
COPY ./data/docker-entrypoint.sh /
31+
32+
33+
###
34+
### Ports
35+
###
36+
EXPOSE 53
37+
EXPOSE 53/udp
38+
39+
40+
####
41+
#### Entrypoint
42+
####
43+
ENTRYPOINT ["/docker-entrypoint.sh"]

Dockerfiles/Dockerfile.latest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.stable

Dockerfile renamed to Dockerfiles/Dockerfile.stable

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
FROM debian:stable-slim
22
LABEL org.opencontainers.image.authors="cytopia@everythingcli.org"
33

4+
ENV \
5+
USER=bind \
6+
GROUP=bind
47

58
###
69
### Install
@@ -9,8 +12,6 @@ RUN set -eux \
912
&& apt update \
1013
&& apt install --no-install-recommends --no-install-suggests -y \
1114
bind9 \
12-
#nsutils \
13-
#putils-ping \
1415
&& apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
1516
&& rm -r /var/lib/apt/lists/* \
1617
&& mkdir /var/log/named \
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ NAMED_LOG_CONF="${NAMED_DIR}/named.conf.logging"
2727
NAMED_CUST_CONF="${NAMED_DIR}/custom/conf"
2828
NAMED_CUST_ZONE="${NAMED_DIR}/custom/zone"
2929

30+
# Recreate custom config directories
31+
if [ -d "${NAMED_CUST_CONF}" ]; then
32+
rm -rf "${NAMED_CUST_CONF}"
33+
fi
34+
if [ -d "${NAMED_CUST_ZONE}" ]; then
35+
rm -rf "${NAMED_CUST_ZONE}"
36+
fi
3037
mkdir -p "${NAMED_CUST_CONF}"
3138
mkdir -p "${NAMED_CUST_ZONE}"
3239

@@ -37,7 +44,13 @@ mkdir -p "${NAMED_CUST_ZONE}"
3744
### When overwriting, use an FQDN by which this container is reachable.
3845
### http://rscott.org/dns/soa.html
3946
###
40-
DEFAULT_MNAME="$( hostname -A | sed 's/\s$//g' | xargs -0 )"
47+
if [ -f "/etc/alpine-release" ]; then
48+
# Alpine
49+
DEFAULT_MNAME="$( hostname -f | sed 's/\s$//g' | xargs -0 )"
50+
else
51+
# Debian
52+
DEFAULT_MNAME="$( hostname -A | sed 's/\s$//g' | xargs -0 )"
53+
fi
4154

4255

4356
###
@@ -532,10 +545,14 @@ log "info" "Debug level: ${DEBUG_ENTRYPOINT}" "${DEBUG_ENTRYPOINT}"
532545
{
533546
echo "include \"${NAMED_LOG_CONF}\";"
534547
echo "include \"${NAMED_OPT_CONF}\";"
535-
echo "include \"/etc/bind/named.conf.local\";"
536-
echo "include \"/etc/bind/named.conf.default-zones\";"
548+
if [ -f "/etc/bind/named.conf.local" ]; then
549+
echo "include \"/etc/bind/named.conf.local\";"
550+
fi
551+
if [ -f "/etc/bind/named.conf.default-zones" ]; then
552+
echo "include \"/etc/bind/named.conf.default-zones\";"
553+
fi
537554
} > "${NAMED_CONF}"
538-
555+
log_file "${NAMED_CONF}"
539556

540557

541558
###
@@ -917,4 +934,4 @@ done <<< "${FWD_ZONES}"
917934
###
918935
log "info" "Starting $( named -V | grep -oiE '^BIND[[:space:]]+[0-9.]+' )" "${DEBUG_ENTRYPOINT}"
919936
named-checkconf "${NAMED_CONF}"
920-
exec /usr/sbin/named -4 -c /etc/bind/named.conf -u bind -f
937+
exec /usr/sbin/named -4 -c /etc/bind/named.conf -u "${USER}" -f

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ TAG = latest
2727
NAME = Bind
2828
VERSION = latest
2929
IMAGE = cytopia/bind
30-
DIR = .
31-
FILE = Dockerfile
32-
DOCKER_TAG = $(TAG)
30+
FLAVOUR = latest
31+
DIR = Dockerfiles
32+
FILE = Dockerfile.$(FLAVOUR)
33+
ifeq ($(strip $(FLAVOUR)),latest)
34+
DOCKER_TAG = $(TAG)
35+
else
36+
ifeq ($(strip $(TAG)),latest)
37+
DOCKER_TAG = $(FLAVOUR)
38+
else
39+
DOCKER_TAG = $(FLAVOUR)-$(TAG)
40+
endif
41+
endif
3342
ARCH = linux/amd64
3443

3544
# Makefile.lint overwrites

0 commit comments

Comments
 (0)