adds ubuntu support

master
Moisés Guimarães 2017-09-13 12:50:58 -03:00
parent 03c5897b52
commit 5722e6a421
8 changed files with 367 additions and 1 deletions

View File

@ -61,8 +61,8 @@ RUN set -eux \
--disable-dependency-tracking \
--enable-sha224 \
--enable-distro \
--disable-examples \
--disable-silent-rules \
--disable-examples \
&& make \
&& make ${WOLFSSL_MAKE_INSTALL} \
&& ldconfig \

View File

@ -0,0 +1,86 @@
#!/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
source ../global-config.sh
# default building params
WOLFSSL_SOURCE="sid"
WOLFSSL_INSTALL="bin"
WOLFSSL_PACKAGES="libwolfssl12/sid"
WOLFSSL_MAKE_INSTALL="install-exec"
function usage()
{
echo "wolfSSL Docker image builder"
echo ""
echo "./docker_build.sh"
echo "\t-h --help prints this help message"
echo "\t--with-dev installs dev files"
echo "\t--from-src installs wolfssl from source files"
echo ""
}
while [ "$1" != "" ]; do
PARAM=`echo $1 | awk -F= '{print $1}'`
VALUE=`echo $1 | awk -F= '{print $2}'`
case $PARAM in
-h | --help)
usage
exit
;;
--with-dev)
WOLFSSL_INSTALL="dev"
WOLFSSL_MAKE_INSTALL="install"
WOLFSSL_PACKAGES=$WOLFSSL_PACKAGES" libwolfssl-dev/sid"
;;
--from-src)
WOLFSSL_SOURCE="src"
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
usage
exit 1
;;
esac
shift
done
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_PACKAGES;
echo ;
docker build \
-t wolfssl/ubuntu:$WOLFSSL_DOCKER_TAG \
-f from-aptitude.dockerfile \
--build-arg WOLFSSL_PACKAGES="$WOLFSSL_PACKAGES" \
.;
else
echo "Building docker image using wolfSSL-$WOLFSSL_VERSION source files";
echo "Using the following wolfssl make instruction: "$WOLFSSL_MAKE_INSTALL;
echo ;
docker build \
-t wolfssl/ubuntu:$WOLFSSL_DOCKER_TAG \
-f from-source.dockerfile \
--build-arg WOLFSSL_VERSION="$WOLFSSL_VERSION" \
--build-arg WOLFSSL_MAKE_INSTALL="$WOLFSSL_MAKE_INSTALL" \
.;
fi

View File

@ -0,0 +1,34 @@
# sid-bin-test.dockerfile
#
# 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
ARG WOLFSSL_UBUNTU_TAG=latest
FROM wolfssl/ubuntu:$WOLFSSL_UBUNTU_TAG
WORKDIR /wolfssl
EXPOSE 11111
ADD examples.tar.gz /wolfssl
COPY docker-entrypoint.sh /wolfssl/docker-entrypoint.sh
ENTRYPOINT ["/wolfssl/docker-entrypoint.sh"]
CMD ["bash"]

View File

@ -0,0 +1,46 @@
#!/bin/sh
#
# Docker examples builder (docker-build-examples.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
source ../../global-config.sh
TAGS="sid-bin src-bin"
docker build \
-t wolfssl/ubuntu/example-builder \
-f example-builder.dockerfile \
--build-arg WOLFSSL_VERSION=$WOLFSSL_VERSION \
.
docker run \
--rm \
--entrypoint cat \
wolfssl/ubuntu/example-builder \
/wolfssl/examples.tar.gz \
> examples.tar.gz
for TAG in $TAGS; do
docker build \
-t wolfssl/ubuntu/example:$TAG \
-f bin-example.dockerfile \
--build-arg WOLFSSL_UBUNTU_TAG=$TAG \
.
done

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
echo "Container's IP address: `awk 'END{print $1}' /etc/hosts`"
if [ "$1" = 'server' ]; then
./examples/server/$@ -bi
else
if [ "$1" = 'client' ]; then
./examples/client/$@
else
exec "$@"
fi
fi

View File

@ -0,0 +1,70 @@
# Dockerfile
#
# 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
FROM ubuntu
# installing build deps
RUN set -eux \
&& buildDeps=' \
autoconf \
automake \
ca-certificates \
curl \
g++ \
libtool \
make \
unzip \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -r /var/lib/apt/lists/*
ARG WOLFSSL_VERSION
# downloading source files
RUN set -eux \
&& 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
RUN set -eux \
&& cd wolfssl-${WOLFSSL_VERSION} \
&& ./autogen.sh \
&& ./configure \
--disable-dependency-tracking \
--enable-sha224 \
--enable-distro \
--disable-silent-rules \
&& make \
&& make check
# create testing package
RUN set -eux \
&& mkdir /wolfssl \
&& tar -czvf /wolfssl/examples.tar.gz \
-C /wolfssl-${WOLFSSL_VERSION} \
examples/client/client \
examples/server/server \
examples/client/.libs \
examples/server/.libs \
certs

View File

@ -0,0 +1,43 @@
# 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
FROM ubuntu
# activate WOLFSSL_INSTALLS arg after FROM
ARG WOLFSSL_PACKAGES
# install wolfssl from sid
RUN set -eux \
# adds required keys to install from sid
&& gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 \
&& gpg -a --export 8B48AD6246925553 | apt-key add - \
&& gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010 \
&& gpg -a --export 7638D0442B90D010 | apt-key add - \
# installs wolfssl from sid
&& 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_PACKAGES} \
# cleanup
&& rm -r /var/lib/apt/lists/* \
&& rm /etc/apt/sources.list.d/wolfssl.list \
&& apt-key del 8B48AD6246925553 \
&& apt-key del 7638D0442B90D010 \
&& rm -r /root/.gnupg

View File

@ -0,0 +1,73 @@
# 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
FROM ubuntu
ARG WOLFSSL_VERSION
ARG WOLFSSL_MAKE_INSTALL
RUN set -eux \
# installing build deps
&& buildDeps=' \
autoconf \
automake \
ca-certificates \
curl \
g++ \
libtool \
make \
unzip \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& 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 \
&& ./configure \
--build=x86_64-linux-gnu \
--prefix=/usr \
--includedir=\${prefix}/include \
--mandir=\${prefix}/share/man \
--infodir=\${prefix}/share/info \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=\${prefix}/lib/x86_64-linux-gnu \
--libexecdir=\${prefix}/lib/x86_64-linux-gnu \
--disable-dependency-tracking \
--enable-sha224 \
--enable-distro \
--disable-silent-rules \
--disable-examples \
&& make \
&& make ${WOLFSSL_MAKE_INSTALL} \
&& ldconfig \
# cleaning building deps
&& cd .. \
&& rm -r wolfssl-${WOLFSSL_VERSION} \
&& apt-get purge -y --auto-remove $buildDeps