2
0
mirror of https://github.com/dnscrypt/dnscrypt-server-docker synced 2024-11-17 15:25:33 +00:00
dnscrypt-server-docker/Dockerfile

82 lines
3.2 KiB
Docker
Raw Normal View History

FROM ubuntu:20.04
LABEL maintainer="Frank Denis"
SHELL ["/bin/sh", "-x", "-c"]
ENV SERIAL 1
2015-07-05 23:39:54 +00:00
ENV CFLAGS=-Ofast
ENV BUILD_DEPS curl make build-essential git libevent-dev libexpat1-dev autoconf file libssl-dev byacc
2019-09-25 20:50:53 +00:00
ENV RUNTIME_DEPS bash util-linux coreutils findutils grep libssl1.1 ldnsutils libevent-2.1 expat ca-certificates runit runit-helper jed
2015-07-05 23:39:54 +00:00
2019-09-25 09:16:12 +00:00
RUN apt-get update; apt-get -qy dist-upgrade; apt-get -qy clean && \
apt-get install -qy --no-install-recommends $RUNTIME_DEPS && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
RUN update-ca-certificates 2> /dev/null || true
2015-07-05 23:39:54 +00:00
ENV UNBOUND_GIT_URL https://github.com/NLnetLabs/unbound.git
ENV UNBOUND_GIT_REVISION release-1.12.0
2015-07-05 23:39:54 +00:00
WORKDIR /tmp
2019-09-25 09:16:12 +00:00
RUN apt-get update; apt-get install -qy --no-install-recommends $BUILD_DEPS && \
git clone --depth=1000 "$UNBOUND_GIT_URL" && \
2019-02-05 17:12:37 +00:00
cd unbound && \
2019-02-05 17:50:10 +00:00
git checkout "$UNBOUND_GIT_REVISION" && \
2015-07-05 23:39:54 +00:00
groupadd _unbound && \
useradd -g _unbound -s /etc -d /dev/null _unbound && \
2017-04-19 08:56:02 +00:00
./configure --prefix=/opt/unbound --with-pthreads \
--with-username=_unbound --with-libevent && \
make -j"$(getconf _NPROCESSORS_ONLN)" install && \
2015-07-05 23:39:54 +00:00
mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example && \
2019-09-22 15:46:46 +00:00
apt-get -qy purge $BUILD_DEPS && apt-get -qy autoremove && \
2015-07-05 23:39:54 +00:00
rm -fr /opt/unbound/share/man && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
2015-07-05 23:39:54 +00:00
ENV RUSTFLAGS "-C link-arg=-s"
2015-07-05 23:39:54 +00:00
2019-09-25 09:29:02 +00:00
RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \
export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Compiling encrypted-dns version 0.3.19" && \
cargo install encrypted-dns && \
mkdir -p /opt/encrypted-dns/sbin && \
mv ~/.cargo/bin/encrypted-dns /opt/encrypted-dns/sbin/ && \
strip --strip-all /opt/encrypted-dns/sbin/encrypted-dns && \
2019-09-22 15:46:46 +00:00
apt-get -qy purge $BUILD_DEPS && apt-get -qy autoremove && \
rm -fr ~/.cargo ~/.rustup && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
2015-07-05 23:39:54 +00:00
RUN groupadd _encrypted-dns && \
mkdir -p /opt/encrypted-dns/empty && \
useradd -g _encrypted-dns -s /etc -d /opt/encrypted-dns/empty _encrypted-dns && \
mkdir -m 700 -p /opt/encrypted-dns/etc/keys && \
2019-09-26 18:57:57 +00:00
mkdir -m 700 -p /opt/encrypted-dns/etc/lists && \
chown _encrypted-dns:_encrypted-dns /opt/encrypted-dns/etc/keys && \
mkdir -m 700 -p /opt/dnscrypt-wrapper/etc/keys && \
2019-09-26 18:57:57 +00:00
mkdir -m 700 -p /opt/dnscrypt-wrapper/etc/lists && \
chown _encrypted-dns:_encrypted-dns /opt/dnscrypt-wrapper/etc/keys
2015-07-05 23:39:54 +00:00
RUN mkdir -p \
/etc/service/unbound \
/etc/service/watchdog
COPY encrypted-dns.toml.in /opt/encrypted-dns/etc/
2019-12-11 15:20:55 +00:00
COPY undelegated.txt /opt/encrypted-dns/etc/
2015-07-07 22:19:02 +00:00
COPY entrypoint.sh /
2015-07-05 23:39:54 +00:00
2015-07-07 22:19:02 +00:00
COPY unbound.sh /etc/service/unbound/run
COPY unbound-check.sh /etc/service/unbound/check
2015-07-05 23:39:54 +00:00
COPY encrypted-dns.sh /etc/service/encrypted-dns/run
2015-07-05 23:39:54 +00:00
2015-07-07 22:19:02 +00:00
COPY watchdog.sh /etc/service/watchdog/run
2015-07-05 23:39:54 +00:00
VOLUME ["/opt/encrypted-dns/etc/keys"]
2015-07-05 23:39:54 +00:00
EXPOSE 443/udp 443/tcp 9100/tcp
2015-07-05 23:39:54 +00:00
2019-09-23 17:40:44 +00:00
CMD ["/entrypoint.sh", "start"]
2015-07-05 23:39:54 +00:00
ENTRYPOINT ["/entrypoint.sh"]