diff --git a/debian/docker-build.sh b/debian/docker-build.sh index 5e4697a..4633869 100755 --- a/debian/docker-build.sh +++ b/debian/docker-build.sh @@ -1,7 +1,5 @@ #!/bin/sh # -# Docker image builder (docker-build.sh) -# # Copyright (C) 2006-2017 wolfSSL Inc. # # This file is part of wolfSSL. @@ -20,10 +18,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -WOLFSSL_DOCKER_TAG="latest" -WOLFSSL_VERSION="3.12.0-stable" +source ../global-config.sh + +# default building params +WOLFSSL_SOURCE="sid" +WOLFSSL_INSTALL="bin" +WOLFSSL_PACKAGES="libwolfssl12/sid" WOLFSSL_MAKE_INSTALL="install-exec" -WOLFSSL_INSTALL="libwolfssl12/sid" function usage() { @@ -45,14 +46,12 @@ while [ "$1" != "" ]; do exit ;; --with-dev) + WOLFSSL_INSTALL="dev" WOLFSSL_MAKE_INSTALL="install" - WOLFSSL_INSTALL=$WOLFSSL_INSTALL" libwolfssl-dev/sid" + WOLFSSL_PACKAGES=$WOLFSSL_PACKAGES" libwolfssl-dev/sid" ;; --from-src) - WOLFSSL_INSTALL_FROM_SOURCE=1 - ;; - --tag) - WOLFSSL_DOCKER_TAG=$VALUE + WOLFSSL_SOURCE="src" ;; *) echo "ERROR: unknown parameter \"$PARAM\"" @@ -63,17 +62,19 @@ while [ "$1" != "" ]; do shift done -if [ "$WOLFSSL_INSTALL_FROM_SOURCE" != "1" ]; then +WOLFSSL_DOCKER_TAG=$WOLFSSL_SOURCE-$WOLFSSL_INSTALL + +if [ "$WOLFSSL_SOURCE" == "sid" ]; then echo "Building docker image using packages from Sid"; - echo "Installing the following wolfssl packages: "$WOLFSSL_INSTALL; + echo "Installing the following wolfssl packages: "$WOLFSSL_PACKAGES; echo ; docker build \ -t wolfssl/debian:$WOLFSSL_DOCKER_TAG \ -f from-aptitude.dockerfile \ - --build-arg WOLFSSL_INSTALL="$WOLFSSL_INSTALL" \ + --build-arg WOLFSSL_PACKAGES="$WOLFSSL_PACKAGES" \ .; else - echo "Building docker image using wolfSSL source files"; + echo "Building docker image using wolfSSL-$WOLFSSL_VERSION source files"; echo "Using the following wolfssl make instruction: "$WOLFSSL_MAKE_INSTALL; echo ; docker build \ diff --git a/debian/example/docker-build-examples.sh b/debian/example/docker-build-examples.sh index 0485a32..8dac358 100755 --- a/debian/example/docker-build-examples.sh +++ b/debian/example/docker-build-examples.sh @@ -20,7 +20,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA -WOLFSSL_VERSION="3.12.0-stable" +source ../../global-config.sh + TAGS="sid-bin src-bin" docker build \ diff --git a/debian/example/example-builder.dockerfile b/debian/example/example-builder.dockerfile index 649731b..66154c1 100644 --- a/debian/example/example-builder.dockerfile +++ b/debian/example/example-builder.dockerfile @@ -34,7 +34,7 @@ RUN set -eux \ ' \ && apt-get update \ && apt-get install -y --no-install-recommends $buildDeps \ - && rm -rf /var/lib/apt/lists/* + && rm -r /var/lib/apt/lists/* ARG WOLFSSL_VERSION diff --git a/debian/from-aptitude.dockerfile b/debian/from-aptitude.dockerfile index b39ffc7..22fb1a3 100644 --- a/debian/from-aptitude.dockerfile +++ b/debian/from-aptitude.dockerfile @@ -1,5 +1,3 @@ -# from-aptitude.dockerfile -# # Copyright (C) 2006-2017 wolfSSL Inc. # # This file is part of wolfSSL. @@ -21,13 +19,13 @@ FROM debian # activate WOLFSSL_INSTALLS arg after FROM -ARG WOLFSSL_INSTALL +ARG WOLFSSL_PACKAGES # install wolfssl from sid RUN set -eux \ && echo "deb http://ftp.it.debian.org/debian sid main contrib non-free" \ > /etc/apt/sources.list.d/wolfssl.list \ && apt-get update \ - && apt-get install -y ${WOLFSSL_INSTALL} \ - && rm -rf /var/lib/apt/lists/* \ + && apt-get install -y ${WOLFSSL_PACKAGES} \ + && rm -r /var/lib/apt/lists/* \ && rm /etc/apt/sources.list.d/wolfssl.list diff --git a/debian/from-source.dockerfile b/debian/from-source.dockerfile index df10a76..53aac0d 100644 --- a/debian/from-source.dockerfile +++ b/debian/from-source.dockerfile @@ -1,5 +1,3 @@ -# Dockerfile -# # Copyright (C) 2006-2017 wolfSSL Inc. # # This file is part of wolfSSL. @@ -38,13 +36,15 @@ RUN set -eux \ ' \ && apt-get update \ && apt-get install -y --no-install-recommends $buildDeps \ - && rm -rf /var/lib/apt/lists/* \ + && rm -r /var/lib/apt/lists/* \ + # downloading source files && curl \ -LS https://github.com/wolfSSL/wolfssl/archive/v${WOLFSSL_VERSION}.zip \ -o v${WOLFSSL_VERSION}.zip \ && unzip v${WOLFSSL_VERSION}.zip \ && rm v${WOLFSSL_VERSION}.zip \ + # building and installing wolfssl && cd wolfssl-${WOLFSSL_VERSION} \ && ./autogen.sh \ @@ -67,7 +67,8 @@ RUN set -eux \ && make check \ && make ${WOLFSSL_MAKE_INSTALL} \ && ldconfig \ + # cleaning building deps && cd .. \ - && rm -rf wolfssl-${WOLFSSL_VERSION} \ + && rm -r wolfssl-${WOLFSSL_VERSION} \ && apt-get purge -y --auto-remove $buildDeps diff --git a/global-config.sh b/global-config.sh new file mode 100755 index 0000000..e8ce5f4 --- /dev/null +++ b/global-config.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Copyright (C) 2006-2017 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + +WOLFSSL_VERSION="3.12.0-stable"