Skip to content

Commit

Permalink
Added DNS Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 30, 2025
1 parent 0e155a2 commit 6ff3353
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/dns-cache_cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: DNS Cache

on:
push:
branches:
- 'main'
paths:
- 'dns-cache/**'
workflow_dispatch:

jobs:

donation-api:
name: Deploy DNS Cache Image
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3.4.0
- name: Publish DNS Cache Docker Image
uses: openzim/docker-publish-action@v10
with:
image-name: kiwix/dns-cache
on-master: latest
restrict-to: kiwix/container-images
context: dns-cache
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
26 changes: 26 additions & 0 deletions dns-cache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM alpine:3.13
LABEL org.opencontainers.image.source=https://github.com/kiwix/container-images

ENV SHELL=bash

RUN set -e \
&& apk update \
&& apk --no-cache add dumb-init bash curl \
# to setup a DNS cache
&& curl -L -o dnsproxy.tar.gz https://github.com/AdguardTeam/dnsproxy/releases/download/v0.74.1/dnsproxy-linux-amd64-v0.74.1.tar.gz \
&& tar x -f dnsproxy.tar.gz --strip-components 2 \
&& mv dnsproxy /usr/bin/

EXPOSE 53

RUN printf "#!/bin/sh\n\
echo "---"\n\
cat /usr/local/bin/entrypoint\n\
echo "---"\n\
echo 'nameserver 127.0.0.1' > /etc/resolv.conf\n\
exec \"\$@\"\n\
" > /usr/local/bin/entrypoint \
&& chmod +x /usr/local/bin/entrypoint

ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/entrypoint"]
CMD ["dnsproxy", "--cache", "--cache-min-ttl", "3600", "--cache-size", "1024", "--hosts-file-enabled", "--ipv6-disabled", "--listen", "0.0.0.0", "--port", "53", "--upstream", "https://1.1.1.1/dns-query"]
6 changes: 6 additions & 0 deletions dns-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# DNS Cache

A simple DNS Cache that uses a DoH (DNS over HTTP) upstream to workaround DNS-related issues.

At the moment, it uses [Cloudflare's DoH](https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/)
because it is both reliable and available without bootstraping DNS to resolve its own domain.

0 comments on commit 6ff3353

Please sign in to comment.