-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
57 lines (44 loc) · 1.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# build stage
FROM ubuntu:19.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt-get install -y git-core golang-go
WORKDIR /root/dnsdist-autoconf
COPY *.go /root/dnsdist-autoconf/
ENV GOPATH=/tmp/go
ENV GOBIN=/tmp/go/bin
RUN /usr/bin/go get ./... \
&& /usr/bin/go build -ldflags="-s -w" -o dnsdist-autoconf
# production stage
FROM debian:10-slim
LABEL maintainer="docker@public.swineson.me"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends curl ca-certificates supervisor cron dnsutils
# add PowerDNS repo
COPY docker/pdns.list.buster /etc/apt/sources.list.d/pdns.list
COPY docker/dnsdist.perference /etc/apt/preferences.d/dnsdist
RUN curl https://repo.powerdns.com/FD380FBB-pub.asc -o /etc/apt/trusted.gpg.d/pdns.asc
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends dnsdist \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# copy executables
RUN mkdir -p /usr/local/bin
COPY --from=builder /root/dnsdist-autoconf/dnsdist-autoconf /usr/local/bin/
COPY docker/*.sh /usr/local/bin/
# for Windows filesystem compatibility, set executable flag
RUN chmod +x /usr/local/bin/*
# setup crontab
COPY docker/crontab.txt /tmp/
RUN crontab /tmp/crontab.txt \
&& rm /tmp/crontab.txt \
&& chmod 600 /etc/crontab
# setup supervisor
COPY docker/supervisord.conf /etc/supervisor/
# setup dnsdist-autoconf default config file
COPY examples/autoconf.toml /etc/dnsdist/autoconf.toml
EXPOSE 53/udp 53/tcp 80/tcp
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
HEALTHCHECK --start-period=30s --interval=30s --timeout=10s --retries=3 CMD /usr/local/bin/healthcheck.sh