extracts global config and makes tags hardcoded.

master
Moisés Guimarães 2017-09-06 09:28:51 -03:00
parent a025a002c0
commit e07897da65
6 changed files with 47 additions and 25 deletions

View File

@ -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 \

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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

21
global-config.sh 100755
View File

@ -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"