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