Merge pull request #56 from PeterDaveHello/Refactor-Dockerfile

Refactor Dockerfile
pull/57/head
Frank Denis 5 years ago committed by GitHub
commit 7f735f89b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,38 +6,41 @@ ENV BUILD_DEPS make gcc musl-dev git libevent-dev expat-dev shadow autoconf fi
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 ldns ldns-tools libevent expat libexecinfo coreutils drill ca-certificates
RUN set -x && \ RUN set -x && \
apk --update upgrade && apk add --no-cache $RUNTIME_DEPS $BUILD_DEPS && \ apk --no-cache upgrade && apk add --no-cache $RUNTIME_DEPS && \
update-ca-certificates 2> /dev/null || true 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
ENV UNBOUND_GIT_REVISION 7bd08b7a9987a0780892131f8590b6e384194bbc ENV UNBOUND_GIT_REVISION 7bd08b7a9987a0780892131f8590b6e384194bbc
RUN set -x && \ RUN set -x && \
apk add --no-cache $BUILD_DEPS && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
git clone "$UNBOUND_GIT_URL" && \ git clone --depth=1000 "$UNBOUND_GIT_URL" && \
cd unbound && \ cd unbound && \
git checkout "$UNBOUND_GIT_REVISION" && \ git checkout "$UNBOUND_GIT_REVISION" && \
groupadd _unbound && \ groupadd _unbound && \
useradd -g _unbound -s /etc -d /dev/null _unbound && \ useradd -g _unbound -s /etc -d /dev/null _unbound && \
./configure --prefix=/opt/unbound --with-pthreads \ ./configure --prefix=/opt/unbound --with-pthreads \
--with-username=_unbound --with-libevent --enable-event-api && \ --with-username=_unbound --with-libevent --enable-event-api && \
make 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 && \
rm -fr /opt/unbound/share/man && \ rm -fr /opt/unbound/share/man && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
ENV LIBSODIUM_GIT_URL https://github.com/jedisct1/libsodium.git ENV LIBSODIUM_GIT_URL https://github.com/jedisct1/libsodium.git
RUN set -x && \ RUN set -x && \
apk add --no-cache $BUILD_DEPS && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
git clone "$LIBSODIUM_GIT_URL" && \ git clone --depth=1 --branch stable "$LIBSODIUM_GIT_URL" && \
cd libsodium && \ cd libsodium && \
git checkout stable && \
env CFLAGS=-Ofast ./configure --disable-dependency-tracking && \ env CFLAGS=-Ofast ./configure --disable-dependency-tracking && \
make check && make install && \ make -j$(getconf _NPROCESSORS_ONLN) check && make -j$(getconf _NPROCESSORS_ONLN) install && \
ldconfig /usr/local/lib && \ ldconfig /usr/local/lib && \
apk del --purge $BUILD_DEPS && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
ENV DNSCRYPT_WRAPPER_GIT_URL https://github.com/jedisct1/dnscrypt-wrapper.git ENV DNSCRYPT_WRAPPER_GIT_URL https://github.com/jedisct1/dnscrypt-wrapper.git
@ -46,9 +49,10 @@ ENV DNSCRYPT_WRAPPER_GIT_BRANCH xchacha-stamps
COPY queue.h /tmp COPY queue.h /tmp
RUN set -x && \ RUN set -x && \
apk add --no-cache $BUILD_DEPS && \
mkdir -p /tmp/src && \ mkdir -p /tmp/src && \
cd /tmp/src && \ cd /tmp/src && \
git clone --branch=${DNSCRYPT_WRAPPER_GIT_BRANCH} ${DNSCRYPT_WRAPPER_GIT_URL} && \ git clone --depth=1 --branch=${DNSCRYPT_WRAPPER_GIT_BRANCH} ${DNSCRYPT_WRAPPER_GIT_URL} && \
cd dnscrypt-wrapper && \ cd dnscrypt-wrapper && \
sed -i 's#<sys/queue.h>#"/tmp/queue.h"#' compat.h && \ sed -i 's#<sys/queue.h>#"/tmp/queue.h"#' compat.h && \
sed -i 's#HAVE_BACKTRACE#NO_BACKTRACE#' compat.h && \ sed -i 's#HAVE_BACKTRACE#NO_BACKTRACE#' compat.h && \
@ -57,13 +61,13 @@ RUN set -x && \
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 -j$(getconf _NPROCESSORS_ONLN) configure && \
env CFLAGS=-Ofast ./configure --prefix=/opt/dnscrypt-wrapper && \ env CFLAGS=-Ofast ./configure --prefix=/opt/dnscrypt-wrapper && \
make install && \ make -j$(getconf _NPROCESSORS_ONLN) install && \
apk del --purge $BUILD_DEPS && \
rm -fr /tmp/* /var/tmp/* rm -fr /tmp/* /var/tmp/*
RUN set -x && \ RUN set -x && \
echo apk del --purge $BUILD_DEPS && \
echo rm -rf /tmp/* /var/tmp/* /usr/local/include echo rm -rf /tmp/* /var/tmp/* /usr/local/include
RUN mkdir -p \ RUN mkdir -p \

Loading…
Cancel
Save