Skip to content

Instantly share code, notes, and snippets.

@mauricioprado00
Last active January 25, 2019 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricioprado00/ee297bfb6a0832efbb2ac7a58e09662c to your computer and use it in GitHub Desktop.
Save mauricioprado00/ee297bfb6a0832efbb2ac7a58e09662c to your computer and use it in GitHub Desktop.
# build docker images for all openssl "old" versions
# download all versions
x_subversions=$(curl https://www.openssl.org/source/old/ | egrep -A20 'entry-content' | grep '<li>' | awk -F '"' '{print $2}')
for x_subversion in $x_subversions; do
echo retrieving subversions $x_subversion
# x_subversion=1.0.2
x_versions=$(curl https://www.openssl.org/source/old/${x_subversion}/ | grep tar.gz | awk -F '"' '{print $2}')
for x_version in $x_versions; do
echo retrieving version $x_version
wget https://www.openssl.org/source/old/${x_subversion}/$x_version
done
done
# build all versions downloaded
docker run --name=openssld-base alpine:3.8 sh -c 'apk add --update alpine-sdk zlib-dev perl bash linux-headers'
docker commit openssld-base opensslbase
cat << EOF > /tmp/builder.sh
#!/usr/bin/env bash
cd /
tar -zxvf source.tgz
cd /openssl*
./config --prefix=/usr \
--openssldir=/etc/ssl \
--libdir=lib \
shared \
zlib-dynamic
make depend
make -j1
make MANDIR=/usr/share/man MANSUFFIX=ssl install \
&& install -dv -m755 /usr/share/doc/openssl-current \
&& cp -vfr doc/* /usr/share/doc/openssl-current
EOF
chmod +x /tmp/builder.sh
# build all versions
x_source_files=$(find . -type f -iname '*.tar.gz')
for x_source_file in $x_source_files; do
x_version=$(echo $x_source_file | sed 's#^\./##g;s#\.tar\.gz$##g')
echo Generating image
echo Source: $x_source_file
echo Version: $x_version
docker run --name=${x_version} -v /tmp/builder.sh:/builder.sh -v $(realpath ${x_source_file}):/source.tgz opensslbase /builder.sh
docker commit ${x_version} ${x_version}
docker rm ${x_version}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment