forked from satishweb/docker-doh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.ubuntu
More file actions
72 lines (57 loc) · 2.03 KB
/
Dockerfile.ubuntu
File metadata and controls
72 lines (57 loc) · 2.03 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Author: Satish Gaikwad <satish@satishweb.com>
# Author: DNS.SB <admin@dns.sb>
FROM golang:1.24-bookworm AS doh-build
LABEL MAINTAINER admin@dns.sb
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y install \
build-essential \
git \
make \
jq \
curl \
unzip
WORKDIR /src
# Lets download latest version of DOH
RUN set -x ;\
DOH_VERSION_LATEST=v2.3.10 \
&& curl -L "https://github.com/m13253/dns-over-https/archive/${DOH_VERSION_LATEST}.zip" -o doh.zip \
&& unzip doh.zip \
&& rm doh.zip \
&& cd dns-over-https* \
&& make doh-server/doh-server \
&& mkdir /dist \
&& cp doh-server/doh-server /dist/doh-server \
&& echo ${DOH_VERSION_LATEST} > /dist/doh-server.version
FROM ubuntu:24.04
LABEL MAINTAINER admin@dns.sb
ENV DEBIAN_FRONTEND noninteractive
COPY --from=doh-build /dist /server
COPY doh-server.sample.conf /server/doh-server.sample.conf
# Install required packages by docker-entrypoint
RUN apt-get update && apt-get -y install \
bash \
gettext \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
/var/cache/apt/archives/*deb
# Add docker entrypoint and make it executable
ADD docker-entrypoint /docker-entrypoint
RUN chmod u+x /docker-entrypoint
# Change owner of the server folder
RUN chown -R nobody:nogroup /server
# Tell docker that all future commands should run as nobody
USER nobody
# Set environment defaults
# We are using DNS.SB DNS server address as default
# Here is the list of addresses: https://dns.sb/guide/
ENV UPSTREAM_DNS_SERVER="udp:185.222.222.222:53"
ENV DOH_HTTP_PREFIX="/getnsrecord"
ENV DOH_SERVER_LISTEN=":8053"
ENV DOH_SERVER_TIMEOUT="10"
ENV DOH_SERVER_TRIES="3"
ENV DOH_SERVER_VERBOSE="false"
EXPOSE 8053
ENTRYPOINT ["/docker-entrypoint"]
CMD [ "/server/doh-server", "-conf", "/server/doh-server.conf" ]
# Healthcheck
HEALTHCHECK --interval=1m --timeout=30s --start-period=1m CMD wget "localhost:$(echo ${DOH_SERVER_LISTEN}|awk -F '[:]' '{print $2}')$(echo ${DOH_HTTP_PREFIX})?name=google.com&type=A" -O /dev/null || exit 1