mirror of
https://github.com/dnscrypt/dnscrypt-server-docker
synced 2024-11-22 23:51:59 +01:00
Switch to Ubuntu - Rust doesn't work well with musl-libc
This commit is contained in:
parent
a3efabd367
commit
cbf9f7c4cc
21
Dockerfile
21
Dockerfile
@ -1,13 +1,14 @@
|
|||||||
FROM jedisct1/alpine-runit:latest
|
FROM ubuntu:19.04
|
||||||
LABEL maintainer="Frank Denis"
|
LABEL maintainer="Frank Denis"
|
||||||
SHELL ["/bin/sh", "-x", "-c"]
|
SHELL ["/bin/sh", "-x", "-c"]
|
||||||
ENV SERIAL 3
|
ENV SERIAL 3
|
||||||
|
|
||||||
ENV CFLAGS=-Ofast
|
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 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 ldns ldns-tools libevent expat libexecinfo coreutils drill ca-certificates
|
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
|
RUN update-ca-certificates 2> /dev/null || true
|
||||||
|
|
||||||
ENV UNBOUND_GIT_URL https://github.com/jedisct1/unbound.git
|
ENV UNBOUND_GIT_URL https://github.com/jedisct1/unbound.git
|
||||||
@ -15,7 +16,7 @@ ENV UNBOUND_GIT_REVISION 35ac577d99d56869f2f87dcc7b5e36b8996df5ca
|
|||||||
|
|
||||||
WORKDIR /tmp
|
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" && \
|
git clone --depth=1000 "$UNBOUND_GIT_URL" && \
|
||||||
cd unbound && \
|
cd unbound && \
|
||||||
git checkout "$UNBOUND_GIT_REVISION" && \
|
git checkout "$UNBOUND_GIT_REVISION" && \
|
||||||
@ -25,16 +26,16 @@ RUN apk add --no-cache $BUILD_DEPS && \
|
|||||||
--with-username=_unbound --with-libevent --enable-event-api && \
|
--with-username=_unbound --with-libevent --enable-event-api && \
|
||||||
make -j"$(getconf _NPROCESSORS_ONLN)" install && \
|
make -j"$(getconf _NPROCESSORS_ONLN)" install && \
|
||||||
mv /opt/unbound/etc/unbound/unbound.conf /opt/unbound/etc/unbound/unbound.conf.example && \
|
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 /opt/unbound/share/man && \
|
||||||
rm -fr /tmp/* /var/tmp/*
|
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
|
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 && \
|
cargo install encrypted-dns && \
|
||||||
mkdir -p /opt/encrypted-dns/sbin && \
|
mkdir -p /opt/encrypted-dns/sbin && \
|
||||||
mkdir -p /opt/encrypted-dns/etc/keys && \
|
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 && \
|
useradd -g _encrypted-dns -s /etc -d /opt/encrypted-dns/empty _encrypted-dns && \
|
||||||
chown _encrypted-dns:_encrypted-dns /opt/encrypted-dns/etc/keys && \
|
chown _encrypted-dns:_encrypted-dns /opt/encrypted-dns/etc/keys && \
|
||||||
chmod 700 /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 ~/.cargo ~/.rustup && \
|
||||||
rm -fr /tmp/* /var/tmp/*
|
rm -fr /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ LEGACY_KEYS_DIR="/opt/dnscrypt-wrapper/etc/keys"
|
|||||||
KEYS_DIR="/opt/encrypted-dns/etc/keys"
|
KEYS_DIR="/opt/encrypted-dns/etc/keys"
|
||||||
CONF_DIR="/opt/encrypted-dns/etc"
|
CONF_DIR="/opt/encrypted-dns/etc"
|
||||||
CONFIG_FILE="${CONF_DIR}/encrypted-dns.toml"
|
CONFIG_FILE="${CONF_DIR}/encrypted-dns.toml"
|
||||||
|
CONFIG_FILE_TEMPLATE="${CONF_DIR}/encrypted-dns.toml.in"
|
||||||
|
|
||||||
# -N provider-name -E external-ip-address:port
|
# -N provider-name -E external-ip-address:port
|
||||||
|
|
||||||
@ -42,10 +42,15 @@ init() {
|
|||||||
|
|
||||||
echo "Provider name: [$provider_name]"
|
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"
|
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 |
|
--config "$CONFIG_FILE" --dry-run |
|
||||||
tee "${KEYS_DIR}/provider-info.txt"
|
tee "${KEYS_DIR}/provider-info.txt"
|
||||||
|
|
||||||
@ -87,7 +92,7 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat << EOT
|
cat <<EOT
|
||||||
Commands
|
Commands
|
||||||
========
|
========
|
||||||
|
|
||||||
@ -107,11 +112,11 @@ EOT
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
start) start ;;
|
start) start ;;
|
||||||
init)
|
init)
|
||||||
shift
|
shift
|
||||||
init $*
|
init $*
|
||||||
;;
|
;;
|
||||||
provider-info) provider_info ;;
|
provider-info) provider_info ;;
|
||||||
*) usage ;;
|
*) usage ;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user