1
1
mirror of https://github.com/dnscrypt/dnscrypt-server-docker synced 2024-11-22 19:42:03 +01:00

Switch to Ubuntu - Rust doesn't work well with musl-libc

This commit is contained in:
Frank Denis 2019-09-22 17:16:03 +02:00
parent a3efabd367
commit cbf9f7c4cc
2 changed files with 38 additions and 32 deletions

@ -1,13 +1,14 @@
FROM jedisct1/alpine-runit:latest
FROM ubuntu:19.04
LABEL maintainer="Frank Denis"
SHELL ["/bin/sh", "-x", "-c"]
ENV SERIAL 3
ENV CFLAGS=-Ofast
ENV BUILD_DEPS curl make gcc musl-dev git libevent-dev expat-dev shadow autoconf file openssl-dev byacc linux-headers
ENV RUNTIME_DEPS bash util-linux coreutils findutils grep openssl ldns ldns-tools libevent expat libexecinfo coreutils drill ca-certificates
ENV BUILD_DEPS curl make build-essential git libevent-dev libexpat1-dev autoconf file libssl-dev byacc
ENV RUNTIME_DEPS bash util-linux coreutils findutils grep openssl ldnsutils libevent-dev expat coreutils ca-certificates runit runit-systemd
RUN apk --no-cache upgrade && apk add --no-cache $RUNTIME_DEPS
RUN apt-get update; apt-get -qy dist-upgrade; apt-get -qy clean
RUN apt-get install -qy --no-install-recommends $RUNTIME_DEPS
RUN update-ca-certificates 2> /dev/null || true
ENV UNBOUND_GIT_URL https://github.com/jedisct1/unbound.git
@ -15,7 +16,7 @@ ENV UNBOUND_GIT_REVISION 35ac577d99d56869f2f87dcc7b5e36b8996df5ca
WORKDIR /tmp
RUN apk add --no-cache $BUILD_DEPS && \
RUN apt-get install -qy --no-install-recommends $BUILD_DEPS && \
git clone --depth=1000 "$UNBOUND_GIT_URL" && \
cd unbound && \
git checkout "$UNBOUND_GIT_REVISION" && \
@ -25,16 +26,16 @@ RUN apk add --no-cache $BUILD_DEPS && \
--with-username=_unbound --with-libevent --enable-event-api && \
make -j"$(getconf _NPROCESSORS_ONLN)" install && \
mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example && \
apk del --purge $BUILD_DEPS && \
apt-get -qy purge $BUILD_DEPS && \
rm -fr /opt/unbound/share/man && \
rm -fr /tmp/* /var/tmp/*
ENV RUSTFLAGS "-C target-feature=-crt-static -C link-arg=-s"
ENV RUSTFLAGS "-C link-arg=-s"
RUN apk add --no-cache $BUILD_DEPS && \
RUN apt-get install -qy --no-install-recommends $BUILD_DEPS && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly
RUN source $HOME/.cargo/env && \
RUN export PATH="$HOME/.cargo/bin:$PATH" && \
cargo install encrypted-dns && \
mkdir -p /opt/encrypted-dns/sbin && \
mkdir -p /opt/encrypted-dns/etc/keys && \
@ -44,7 +45,7 @@ RUN source $HOME/.cargo/env && \
useradd -g _encrypted-dns -s /etc -d /opt/encrypted-dns/empty _encrypted-dns && \
chown _encrypted-dns:_encrypted-dns /opt/encrypted-dns/etc/keys && \
chmod 700 /opt/encrypted-dns/etc/keys && \
apk del --purge $BUILD_DEPS && \
apt-get -qy purge $BUILD_DEPS && \
rm -fr ~/.cargo ~/.rustup && \
rm -fr /tmp/* /var/tmp/*

@ -8,7 +8,7 @@ LEGACY_KEYS_DIR="/opt/dnscrypt-wrapper/etc/keys"
KEYS_DIR="/opt/encrypted-dns/etc/keys"
CONF_DIR="/opt/encrypted-dns/etc"
CONFIG_FILE="${CONF_DIR}/encrypted-dns.toml"
CONFIG_FILE_TEMPLATE="${CONF_DIR}/encrypted-dns.toml.in"
# -N provider-name -E external-ip-address:port
@ -42,10 +42,15 @@ init() {
echo "Provider name: [$provider_name]"
echo "$provider_name" > "${KEYS_DIR}/provider_name"
echo "$provider_name" >"${KEYS_DIR}/provider_name"
chmod 644 "${KEYS_DIR}/provider_name"
/opt/encrypted-dns/sbin/dnscrypted-dns \
sed \
-e "s/@PROVIDER_NAME@/${provider_name}/" \
-e "s/@EXTERNAL_IPV4@/${ext_address}/" \
"$CONFIG_FILE_TEMPLATE" >"$CONFIG_FILE"
/opt/encrypted-dns/sbin/encrypted-dns \
--config "$CONFIG_FILE" --dry-run |
tee "${KEYS_DIR}/provider-info.txt"
@ -87,7 +92,7 @@ start() {
}
usage() {
cat << EOT
cat <<EOT
Commands
========
@ -107,11 +112,11 @@ EOT
}
case "$action" in
start) start ;;
init)
start) start ;;
init)
shift
init $*
;;
provider-info) provider_info ;;
*) usage ;;
provider-info) provider_info ;;
*) usage ;;
esac