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

dockerfile, makefile and readme #26

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions cmd/dnsp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dnsp
13 changes: 13 additions & 0 deletions cmd/dnsp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:latest

RUN apt-get update
RUN apt-get install dnsutils -y
RUN mkdir /app
ADD *.go /app/
WORKDIR /app
RUN go get -u github.com/gophergala/dnsp/...
RUN go build -o /app/dnsp

EXPOSE 53

ENTRYPOINT ["/app/dnsp"]
6 changes: 6 additions & 0 deletions cmd/dnsp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
docker build . -t dnsp
serve:
docker run --rm -p 53:53/udp dnsp --resolve 8.8.4.4,8.8.8.8 --blacklist=https://hosts-file.net/download/hosts.txt --poll 1h -l 0.0.0.0:53
debug:
docker run --rm -p 5353:53/udp dnsp --resolve 8.8.4.4,8.8.8.8 --blacklist=https://hosts-file.net/download/hosts.txt --poll 1h -l 0.0.0.0:53
14 changes: 14 additions & 0 deletions cmd/dnsp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# dnsp
DNSP Server binary and docker file.

### Building Docker Image

`make build`

### Running Docker Container Locally (port 5353)

`make debug`

### Running Docker Container as Server (port 53)

`make serve`
60 changes: 60 additions & 0 deletions cmd/dnsp/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: dnsp-home
labels:
app: dnsp-home
spec:
revisionHistoryLimit: 1
replicas: 2
selector:
matchLabels:
app: dnsp-home
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: dnsp-home
name: dnsp-home
spec:
terminationGracePeriodSeconds: 15
containers:
- args:
- --blacklist=https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
- --poll=72h
- --resolve=8.8.8.8,4.4.4.4
name: "dnsp-home"
image: "docker.io/integrii/dnsp"
imagePullPolicy: Always
resources:
requests:
memory: "50Mi"
cpu: "100m"
readinessProbe:
exec:
command:
- "nslookup"
- "google.com."
- "127.0.0.1"
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 1
livenessProbe:
exec:
command:
- "nslookup"
- "google.com."
- "127.0.0.1"
initialDelaySeconds: 120
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 1
ports:
- containerPort: 53
name: dns-server
protocol: UDP
14 changes: 14 additions & 0 deletions cmd/dnsp/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: dnsp-home
name: dnsp-home
spec:
ports:
- port: 53
protocol: UDP
targetPort: dns-server
selector:
app: dnsp-home
type: LoadBalancer