Skip to content

Commit

Permalink
feat(coredns): re-enable image build
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bn committed Aug 10, 2024
1 parent 4c834f5 commit b7624ed
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-coredns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Build CoreDNS image
on:
push:
branches:
- main
paths:
- 'coredns/**'
- '!coredns/README.md'
- '.github/workflows/build-coredns.yml'
workflow_dispatch:
schedule:
- cron: '35 4 * * 6' # Every Saturday at 04:35am
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
version: ['1.11.3']
steps:
- name: Check-out repository
uses: actions/checkout@v4

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

- name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image to registry
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: ./coredns
file: ./coredns/Dockerfile
push: true
build-args: |
VERSION=${{ matrix.version }}
tags: |
ghcr.io/f-bn/coredns:${{ matrix.version }}
ghcr.io/f-bn/coredns:latest
10 changes: 5 additions & 5 deletions coredns/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# --- Build stage ---
FROM docker.io/golang:1.20 AS build
FROM docker.io/golang:1.22 AS build

ARG TARGETOS
ARG TARGETARCH
ARG VERSION=1.11.1
ARG VERSION=1.11.3

ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
Expand All @@ -24,18 +24,18 @@ RUN set -ex ; \
# --- Final stage ---
FROM cgr.dev/chainguard/wolfi-base:latest

ARG VERSION

COPY --from=build --chmod=755 /build/bin/coredns /usr/bin/coredns

RUN mkdir -p /etc/coredns

USER nonroot

EXPOSE 53/tcp 53/udp

ENTRYPOINT [ "/usr/bin/coredns" ]

LABEL \
org.opencontainers.image.title="CoreDNS" \
org.opencontainers.image.title="coredns" \
org.opencontainers.image.source="https://github.com/f-bn/containers-images/coredns" \
org.opencontainers.image.description="CoreDNS is a DNS server that chains plugins" \
org.opencontainers.image.licenses="Apache-2.0" \
Expand Down
15 changes: 14 additions & 1 deletion coredns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@

Custom CoreDNS image built from sources.

Built with Go 1.20.
Built with Go 1.22.

## CoreDNS configuration

This image doesn't come with a default CoreDNS configuration. You can bring your own configuration to the container (e.g using Docker):

```shell
$ docker run [options] \
-v Corefile:/etc/coredns/Corefile:ro \
-v /path/to/zonefiles:/etc/coredns/zones:ro \
ghcr.io/f-bn/coredns:1.11.3 -conf /etc/coredns/Corefile
```

More informations about CoreDNS configuration [here](https://coredns.io/manual/configuration/).

0 comments on commit b7624ed

Please sign in to comment.