Commit 41dcd3ed authored by Marek Vavruša's avatar Marek Vavruša

build: updated dockerfile, added BUILD_IGNORE for depends

parent 27878393
...@@ -70,6 +70,7 @@ ifeq ($$(strip $$($(1)_LIBS)),) ...@@ -70,6 +70,7 @@ ifeq ($$(strip $$($(1)_LIBS)),)
else else
HAS_$(1) := yes HAS_$(1) := yes
$(1): $(1):
.PHONY: $(1)
endif endif
endef endef
......
FROM cznic/knot:latest FROM debian:jessie
MAINTAINER Marek Vavrusa <marek.vavrusa@nic.cz> MAINTAINER Marek Vavrusa <marek.vavrusa@nic.cz>
# Environment # Environment
ENV THREADS 4 ENV THREADS 4
ENV BUILD_PKGS git-core make gcc libtool autoconf pkg-config libcmocka-dev libgnutls28-dev liblmdb-dev libjansson-dev ENV BUILD_PKGS git-core make gcc libtool autoconf pkg-config cmake libgnutls28-dev libjansson-dev
ENV RUNTIME_PKGS libgnutls28 libjansson liblmdb0 ENV RUN_PKGS libgnutls-deb0-28 libjansson4
ENV PREFIX /usr/local
ENV BUILD_DIR /tmp/build
ENV BUILD_IGNORE gmp nettle jansson gnutls
# Expose port # Expose port
EXPOSE 53 EXPOSE 53
...@@ -15,28 +18,18 @@ CMD ["/usr/local/sbin/kresolved", "-a", "0.0.0.0#53"] ...@@ -15,28 +18,18 @@ CMD ["/usr/local/sbin/kresolved", "-a", "0.0.0.0#53"]
# Install dependencies and sources # Install dependencies and sources
RUN apt-get -q -y update && \ RUN apt-get -q -y update && \
apt-get install -q -y ${BUILD_PKGS} ${RUNTIME_PKGS} && \ apt-get install -q -y ${BUILD_PKGS} ${RUN_PKGS} && \
# Install libuv # Install dependencies
git clone https://github.com/libuv/libuv.git /libuv-src && \ git clone https://gitlab.labs.nic.cz/knot/resolver.git ${BUILD_DIR} && \
cd /libuv-src && \ cd ${BUILD_DIR} && \
sh autogen.sh && \ ./scripts/bootstrap-depends.sh ${PREFIX} && \
./configure && \
make -j${THREADS} && \
make install && \
ldconfig && \ ldconfig && \
# Install knot-resolver # Install knot-resolver
git clone https://gitlab.labs.nic.cz/knot/resolver.git /resolver-src && \
cd /resolver-src && \
sh ./bootstrap && \
./configure && \
make -j${THREADS} && \ make -j${THREADS} && \
make check && \
make install && \ make install && \
ldconfig && \ ldconfig && \
# Trim down the image # Trim down the image
rm -rf /libuv-src && \
rm -rf /resolver-src && \
apt-get purge -q -y ${BUILD_PKGS} && \ apt-get purge -q -y ${BUILD_PKGS} && \
apt-get autoremove -q -y && \ apt-get autoremove -q -y && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*
...@@ -45,7 +45,7 @@ function fetch_pkg { ...@@ -45,7 +45,7 @@ function fetch_pkg {
function build_pkg { function build_pkg {
if [ -f CMakeLists.txt ]; then if [ -f CMakeLists.txt ]; then
[ -e cmake-build ] && rm -r cmake-build; mkdir cmake-build; cd cmake-build [ -e cmake-build ] && rm -rf cmake-build; mkdir cmake-build; cd cmake-build
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
else else
if [ ! -e ./configure ]; then if [ ! -e ./configure ]; then
...@@ -58,7 +58,7 @@ function build_pkg { ...@@ -58,7 +58,7 @@ function build_pkg {
} }
function pkg { function pkg {
if [ ! -e ${PREFIX}/$4 ]; then if [ ! -e ${PREFIX}/$4 ] && [ "${BUILD_IGNORE}" == "${BUILD_IGNORE/$1/}" ] ; then
cd ${BUILD_DIR} cd ${BUILD_DIR}
echo "[x] fetching $1-$3" echo "[x] fetching $1-$3"
fetch_pkg "$1-$3" "$2" $3 >> ${LOG} fetch_pkg "$1-$3" "$2" $3 >> ${LOG}
...@@ -98,4 +98,7 @@ pkg libknot ${KNOT_URL} ${KNOT_TAG} include/libknot \ ...@@ -98,4 +98,7 @@ pkg libknot ${KNOT_URL} ${KNOT_TAG} include/libknot \
# cmocka # cmocka
pkg cmocka ${CMOCKA_URL} ${CMOCKA_TAG} include/cmocka.h pkg cmocka ${CMOCKA_URL} ${CMOCKA_TAG} include/cmocka.h
# libuv # libuv
pkg libuv ${LIBUV_URL} ${LIBUV_TAG} include/uv.h --disable-static pkg libuv ${LIBUV_URL} ${LIBUV_TAG} include/uv.h --disable-static
\ No newline at end of file
# remove on successful build
rm -rf ${BUILD_DIR}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment