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

Switch to Alpine Linux

This commit is contained in:
Frank Denis 2017-04-19 10:56:02 +02:00
parent e458df5b7e
commit 74fb53de51
3 changed files with 23 additions and 62 deletions

@ -1,66 +1,32 @@
FROM jedisct1/phusion-baseimage-latest:17.04 FROM jedisct1/alpine-runit:latest
MAINTAINER Frank Denis MAINTAINER Frank Denis
ENV SERIAL 1 ENV SERIAL 1
ENV DEBIAN_FRONTEND noninteractive ENV BUILD_DEPS make gcc musl-dev git ldns-dev libevent-dev expat-dev shadow autoconf file libexecinfo-dev
ENV BUILD_DEPS autoconf file gcc git libc-dev make pkg-config ENV RUNTIME_DEPS libressl ldns ldns-tools libevent expat libtool libexecinfo coreutils drill
RUN set -x && \ RUN set -x && \
apt-get update && apt-get install -y \ apk --update upgrade && apk add $RUNTIME_DEPS $BUILD_DEPS
$BUILD_DEPS \
bsdmainutils \
ldnsutils \
--no-install-recommends
ENV LIBRESSL_VERSION 2.5.3
ENV LIBRESSL_SHA256 14e34cc586ec4ce5763f76046dcf366c45104b2cc71d77b63be5505608e68a30
ENV LIBRESSL_DOWNLOAD_URL http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz
RUN set -x && \
mkdir -p /tmp/src && \
cd /tmp/src && \
curl -sSL $LIBRESSL_DOWNLOAD_URL -o libressl.tar.gz && \
echo "${LIBRESSL_SHA256} *libressl.tar.gz" | sha256sum -c - && \
tar xzf libressl.tar.gz && \
rm -f libressl.tar.gz && \
cd libressl-${LIBRESSL_VERSION} && \
./configure --disable-dependency-tracking --prefix=/opt/libressl && \
make check && make install && \
rm -fr /opt/libressl/share/man && \
echo /opt/libressl/lib > /etc/ld.so.conf.d/libressl.conf && ldconfig && \
rm -fr /tmp/*
ENV UNBOUND_VERSION 1.6.1 ENV UNBOUND_VERSION 1.6.1
ENV UNBOUND_SHA256 42df63f743c0fe8424aeafcf003ad4b880b46c14149d696057313f5c1ef51400 ENV UNBOUND_SHA256 42df63f743c0fe8424aeafcf003ad4b880b46c14149d696057313f5c1ef51400
ENV UNBOUND_DOWNLOAD_URL https://www.unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz ENV UNBOUND_DOWNLOAD_URL https://www.unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz
RUN set -x && \ RUN set -x && \
apt-get update && \
apt-get install -y \
libevent-2.0 \
libevent-dev \
libexpat1 \
libexpat1-dev \
--no-install-recommends && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
curl -sSL $UNBOUND_DOWNLOAD_URL -o unbound.tar.gz && \ wget -O unbound.tar.gz $UNBOUND_DOWNLOAD_URL && \
echo "${UNBOUND_SHA256} *unbound.tar.gz" | sha256sum -c - && \ echo "${UNBOUND_SHA256} *unbound.tar.gz" | sha256sum -c - && \
tar xzf unbound.tar.gz && \ tar xzf unbound.tar.gz && \
rm -f unbound.tar.gz && \ rm -f unbound.tar.gz && \
cd unbound-${UNBOUND_VERSION} && \ cd unbound-${UNBOUND_VERSION} && \
groupadd _unbound && \ groupadd _unbound && \
useradd -g _unbound -s /etc -d /dev/null _unbound && \ useradd -g _unbound -s /etc -d /dev/null _unbound && \
./configure --disable-dependency-tracking --prefix=/opt/unbound --with-pthreads \ ./configure --prefix=/opt/unbound --with-pthreads \
--with-username=_unbound --with-ssl=/opt/libressl --with-libevent \ --with-username=_unbound --with-libevent --enable-event-api && \
--enable-event-api && \
make install && \ make 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 && \
rm -fr /opt/unbound/share/man && \ rm -fr /opt/unbound/share/man && \
apt-get purge -y --auto-remove \
libexpat-dev \
libevent-dev && \
apt-get autoremove -y && apt-get clean && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
ENV LIBSODIUM_VERSION 1.0.12 ENV LIBSODIUM_VERSION 1.0.12
@ -70,15 +36,15 @@ ENV LIBSODIUM_DOWNLOAD_URL https://download.libsodium.org/libsodium/releases/lib
RUN set -x && \ RUN set -x && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
curl -sSL $LIBSODIUM_DOWNLOAD_URL -o libsodium.tar.gz && \ wget -O libsodium.tar.gz $LIBSODIUM_DOWNLOAD_URL && \
echo "${LIBSODIUM_SHA256} *libsodium.tar.gz" | sha256sum -c - && \ echo "${LIBSODIUM_SHA256} *libsodium.tar.gz" | sha256sum -c - && \
tar xzf libsodium.tar.gz && \ tar xzf libsodium.tar.gz && \
rm -f libsodium.tar.gz && \ rm -f libsodium.tar.gz && \
cd libsodium-${LIBSODIUM_VERSION} && \ cd libsodium-${LIBSODIUM_VERSION} && \
./configure --disable-dependency-tracking --prefix=/opt/libsodium && \ env CFLAGS=-Ofast ./configure --disable-dependency-tracking && \
make check && make install && \ make check && make install && \
echo /opt/libsodium/lib > /etc/ld.so.conf.d/libsodium.conf && ldconfig && \ ldconfig /usr/local/lib && \
rm -fr /tmp/* rm -fr /tmp/* /var/tmp/*
ENV DNSCRYPT_PROXY_VERSION 1.9.4 ENV DNSCRYPT_PROXY_VERSION 1.9.4
ENV DNSCRYPT_PROXY_SHA256 40543efbcd56033ac03a1edf4581305e8c9bed4579ac55e6279644f07c315307 ENV DNSCRYPT_PROXY_SHA256 40543efbcd56033ac03a1edf4581305e8c9bed4579ac55e6279644f07c315307
@ -87,7 +53,7 @@ ENV DNSCRYPT_PROXY_DOWNLOAD_URL https://download.dnscrypt.org/dnscrypt-proxy/dns
RUN set -x && \ RUN set -x && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
curl -sSL $DNSCRYPT_PROXY_DOWNLOAD_URL -o dnscrypt-proxy.tar.gz && \ wget -O dnscrypt-proxy.tar.gz $DNSCRYPT_PROXY_DOWNLOAD_URL && \
echo "${DNSCRYPT_PROXY_SHA256} *dnscrypt-proxy.tar.gz" | sha256sum -c - && \ echo "${DNSCRYPT_PROXY_SHA256} *dnscrypt-proxy.tar.gz" | sha256sum -c - && \
tar xzf dnscrypt-proxy.tar.gz && \ tar xzf dnscrypt-proxy.tar.gz && \
rm -f dnscrypt-proxy.tar.gz && \ rm -f dnscrypt-proxy.tar.gz && \
@ -95,8 +61,7 @@ RUN set -x && \
mkdir -p /opt/dnscrypt-proxy/empty && \ mkdir -p /opt/dnscrypt-proxy/empty && \
groupadd _dnscrypt-proxy && \ groupadd _dnscrypt-proxy && \
useradd -g _dnscrypt-proxy -s /etc -d /opt/dnscrypt-proxy/empty _dnscrypt-proxy && \ useradd -g _dnscrypt-proxy -s /etc -d /opt/dnscrypt-proxy/empty _dnscrypt-proxy && \
env CPPFLAGS=-I/opt/libsodium/include LDFLAGS=-L/opt/libsodium/lib \ env CFLAGS=-Os ./configure --disable-dependency-tracking --prefix=/opt/dnscrypt-proxy --disable-plugins && \
./configure --disable-dependency-tracking --prefix=/opt/dnscrypt-proxy --disable-plugins && \
make install && \ make install && \
rm -fr /opt/dnscrypt-proxy/share && \ rm -fr /opt/dnscrypt-proxy/share && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
@ -105,33 +70,30 @@ ENV DNSCRYPT_WRAPPER_VERSION 0.2.2
ENV DNSCRYPT_WRAPPER_SHA256 6fa0d2bea41a11c551d6b940bf4dffeaaa0e034fffd8c67828ee2093c1230fee ENV DNSCRYPT_WRAPPER_SHA256 6fa0d2bea41a11c551d6b940bf4dffeaaa0e034fffd8c67828ee2093c1230fee
ENV DNSCRYPT_WRAPPER_DOWNLOAD_URL https://github.com/Cofyc/dnscrypt-wrapper/releases/download/v${DNSCRYPT_WRAPPER_VERSION}/dnscrypt-wrapper-v${DNSCRYPT_WRAPPER_VERSION}.tar.bz2 ENV DNSCRYPT_WRAPPER_DOWNLOAD_URL https://github.com/Cofyc/dnscrypt-wrapper/releases/download/v${DNSCRYPT_WRAPPER_VERSION}/dnscrypt-wrapper-v${DNSCRYPT_WRAPPER_VERSION}.tar.bz2
COPY queue.h /tmp
RUN set -x && \ RUN set -x && \
apt-get update && \
apt-get install -y \
libevent-2.0 \
libevent-dev \
--no-install-recommends && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
curl -sSL $DNSCRYPT_WRAPPER_DOWNLOAD_URL -o dnscrypt-wrapper.tar.bz2 && \ wget -O dnscrypt-wrapper.tar.bz2 $DNSCRYPT_WRAPPER_DOWNLOAD_URL && \
echo "${DNSCRYPT_WRAPPER_SHA256} *dnscrypt-wrapper.tar.bz2" | sha256sum -c - && \ echo "${DNSCRYPT_WRAPPER_SHA256} *dnscrypt-wrapper.tar.bz2" | sha256sum -c - && \
tar xjf dnscrypt-wrapper.tar.bz2 && \ tar xjf dnscrypt-wrapper.tar.bz2 && \
cd dnscrypt-wrapper-v${DNSCRYPT_WRAPPER_VERSION} && \ cd dnscrypt-wrapper-v${DNSCRYPT_WRAPPER_VERSION} && \
sed -i 's#<sys/queue.h>#"/tmp/queue.h"#' compat.h && \
sed -i 's#HAVE_BACKTRACE#NO_BACKTRACE#' compat.h && \
mkdir -p /opt/dnscrypt-wrapper/empty && \ mkdir -p /opt/dnscrypt-wrapper/empty && \
groupadd _dnscrypt-wrapper && \ groupadd _dnscrypt-wrapper && \
useradd -g _dnscrypt-wrapper -s /etc -d /opt/dnscrypt-wrapper/empty _dnscrypt-wrapper && \ useradd -g _dnscrypt-wrapper -s /etc -d /opt/dnscrypt-wrapper/empty _dnscrypt-wrapper && \
groupadd _dnscrypt-signer && \ groupadd _dnscrypt-signer && \
useradd -g _dnscrypt-signer -G _dnscrypt-wrapper -s /etc -d /dev/null _dnscrypt-signer && \ useradd -g _dnscrypt-signer -G _dnscrypt-wrapper -s /etc -d /dev/null _dnscrypt-signer && \
make configure && \ make configure && \
./configure --prefix=/opt/dnscrypt-wrapper --with-sodium=/opt/libsodium && \ env CFLAGS=-Ofast ./configure --prefix=/opt/dnscrypt-wrapper && \
make install && \ make install && \
apt-get purge -y --auto-remove libevent-dev && \
apt-get autoremove -y && apt-get clean && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
RUN set -x && \ RUN set -x && \
apt-get purge -y --auto-remove $BUILD_DEPS && \ apk del --purge $BUILD_DEPS && \
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /tmp/* /var/tmp/* /usr/local/include
RUN mkdir -p \ RUN mkdir -p \
/etc/service/unbound \ /etc/service/unbound \
@ -151,6 +113,6 @@ VOLUME ["/opt/dnscrypt-wrapper/etc/keys"]
EXPOSE 443/udp 443/tcp EXPOSE 443/udp 443/tcp
CMD ["start"] CMD ["/sbin/start_runit"]
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

@ -73,7 +73,7 @@ start() {
ensure_initialized ensure_initialized
echo "Starting DNSCrypt service for provider: " echo "Starting DNSCrypt service for provider: "
cat "${KEYS_DIR}/provider_name" cat "${KEYS_DIR}/provider_name"
exec /sbin/my_init exec /sbin/start_runit
} }
usage() { usage() {

@ -84,7 +84,6 @@ server:
remote-control: remote-control:
control-enable: yes control-enable: yes
control-interface: 127.0.0.1 control-interface: 127.0.0.1
control-interface: ::1
EOT EOT
mkdir -p /opt/unbound/etc/unbound/dev && \ mkdir -p /opt/unbound/etc/unbound/dev && \