File: create-ssl-image

package info (click to toggle)
erlang 1%3A25.2.3%2Bdfsg-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 219,452 kB
  • sloc: erlang: 1,440,534; xml: 473,412; ansic: 392,382; cpp: 164,287; makefile: 17,392; sh: 13,842; lisp: 9,675; java: 8,578; asm: 6,426; perl: 5,527; python: 5,469; javascript: 610; pascal: 126; sed: 72; php: 3
file content (82 lines) | stat: -rwxr-xr-x 1,598 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh

# ./create-image openssl 1.0.2m [in-file] 

case "$1" in
    "openssl")
	FAM=openssl
	VER=$2
	PFX=https://www.openssl.org/source/openssl-
	SFX=.tar.gz
	TMP=tmp.tar.gz
	;;
    "libressl")
	FAM=libressl
	VER=$2
	PFX=https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-
	SFX=.tar.gz
	TMP=tmp.tar.gz
	;;
    *)
	echo No lib type
	exit
	;;
esac

INPUT_FILE=$3

case $1$2 in
    openssl0.9.8[a-l])
        CONFIG_FLAGS=no-asm
	;;
    *)
	CONFIG_FLAGS=
	;;
esac


# This way of fetching the tar-file separate from the docker commands makes
# http-proxy handling way easier. The wget command handles the $https_proxy
# variable while the docker command must have /etc/docker/something changed
# and the docker server restarted. That is not possible without root access.

# Make a Dockerfile. This method simplifies env variable handling considerably:
cat - > TempDockerFile <<EOF

    FROM ssh_compat_suite-ubuntu:latest

    LABEL version=$FAM-$VER

    WORKDIR /buildroot

    COPY ${TMP} .
    RUN  tar xf ${TMP}

    WORKDIR ${FAM}-${VER}

    RUN  ./config --prefix=/buildroot/ssl ${CONFIG_FLAGS}

    RUN  make
    RUN  make install_sw

    RUN  echo Built ${FAM}-${VER}
EOF

# Fetch the tar file. This could be done in an "ADD ..." in the Dockerfile,
# but then we hit the proxy problem...

if [ "x$INPUT_FILE" = "x" ]
then
    wget -O $TMP $PFX$VER$SFX

elif [ "x$INPUT_FILE" != "x$TMP" ]
then
     echo "Use $INPUT_FILE for input"
    cp $INPUT_FILE $TMP
fi

# Build the image:
docker build -t ssh_compat_suite-$FAM:$VER -f ./TempDockerFile .

# Cleaning
rm -fr ./TempDockerFile $TMP