Skip to content

Commit

Permalink
Merge pull request #4 from FreifunkMD/simplify
Browse files Browse the repository at this point in the history
Simplify the Container build
  • Loading branch information
Kwa5ir authored Oct 25, 2022
2 parents 2be080d + 9d4eefd commit 5dbf762
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 57 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Image CI

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ffmd/bind9-ffmd
tags: |
# 123
type=match,pattern=v(.*),group=1
# generate lates from default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create Release

on:
push:
tags:
- "v*"

jobs:
build:
name: "Release"
runs-on: ubuntu-18.04
steps:
- name: "Check-out"
uses: actions/checkout@v3
- name: "Generate release changelog"
id: generate-release-changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
onlyLastTag: "true" # set to false if no tags exist (buggy with only one tag)
stripHeaders: "true"
stripGeneratorNotice: "true"
- name: Extract the VERSION name
id: get-version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: "Create GitHub release"
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: "${{ steps.get-version.outputs.VERSION }}"
body: "${{ steps.generate-release-changelog.outputs.changelog }}"
token: ${{ secrets.GITHUB_TOKEN }}
draft: True
1 change: 0 additions & 1 deletion 01proxy

This file was deleted.

31 changes: 4 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
FROM debian:buster AS install

ARG GITREPO
ARG GITREF=master

# Apt-proxy config
COPY apt-proxy-detect.sh /usr/local/lib/
COPY 01proxy /etc/apt/apt.conf.d

# Keep apt cache directories!
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
git

RUN git clone $GITREPO /tmp/bind
RUN cd /tmp/bind && git checkout $GITREF

# Download bind9 for the next stage
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
--download-only \
bind9


FROM debian:buster

LABEL maintainer="[email protected]"

COPY --from=install /var/lib/apt/lists/ /var/lib/apt/lists/
COPY --from=install /var/cache/apt/ /var/cache/apt/

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
bind9 \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
Expand All @@ -37,4 +11,7 @@ COPY --from=install /tmp/bind /etc/bind

EXPOSE 53/udp 53/tcp

COPY named.conf.local /etc/bind
COPY ffmd.zone /etc/bind

CMD ["/usr/sbin/named", "-f", "-g"]
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Docker image for git-configured bind9
# ffmd Bind9 Image

Arguments:
* GITREPO: Git reporistory URI
* GITREF: Branch or tag in GITREPO, defaults to `master`
> Bind9 container image with configuration for the ffmd zone
Build with as
```
docker build --build-arg GITREPO=<git uri> --build-arg GITREF=<branch or tag>
## Releases

Releases are created automatically based on the version.

**Version tags** follow the serial numbers, e.g. `v2022060801`.
The serial number will be the tag for the docker image.

## Deploy

### with Docker

```bash
docker run --rm -it -p 127.0.0.1:53:53/udp ffmd/bind9-ffmd:latest
```

### Production

The production image is deployed using [Ansible](https://github.com/FreifunkMD/backend-ffmd) via [backend-ffmd](https://github.com/FreifunkMD/backend-ffmd).


20 changes: 0 additions & 20 deletions apt-proxy-detect.sh

This file was deleted.

28 changes: 28 additions & 0 deletions ffmd.zone
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$ORIGIN ffmd.
$TTL 86400
@ SOA ns1.ffmdnic.ffmd. abuse.md.freifunk.net. (
2019110102 ; serial
21600 ; refresh after 6 hours
3600 ; retry after 1 hour
604800 ; expire after 1 week
86400 ) ; minimum TTL of 1 day
NS ns1.ffmdnic.ffmd.
;
ns1.ffmdnic A 10.139.0.53
AAAA fda9:26e:5805::9
AAAA fda9:26e:5805::2
;
nextnode A 10.139.0.1
AAAA fda9:026e:5805::1
;
1.ntp AAAA fda9:26e:5805::9
2.ntp AAAA fda9:26e:5805::2
;
stable.updates.firmware AAAA fda9:26e:5805::9
beta.updates.firmware AAAA fda9:26e:5805::9
experimental.updates.firmware AAAA fda9:26e:5805::9
;
stable-babel.updates.firmware AAAA fda9:26e:5805::9
experimental-babel.updates.firmware AAAA fda9:26e:5805::9
test-babel.updates.firmware AAAA fda9:26e:5805::9
;
2 changes: 0 additions & 2 deletions hooks/build

This file was deleted.

12 changes: 12 additions & 0 deletions named.conf.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "ffmd" IN {
type master;
file "/etc/bind/ffmd.zone";
};

0 comments on commit 5dbf762

Please sign in to comment.