-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_http.sh
executable file
·53 lines (43 loc) · 1.21 KB
/
build_http.sh
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
#!/bin/bash
#
#################################
# do not call this script directly.
# use the Makefile.
#################################
#
# Build the http docker container using the Dockerfile
#
# https://charlesreid1.com/wiki/Docker/Dockerfiles
SED="/bin/sed"
function usage {
echo ""
echo "build_http.sh script:"
echo "builds an http stunnel docker container."
echo "specify a port number for the stunnel server to use:"
echo ""
echo " ./build_http.sh 666"
echo ""
}
if [[ "$#" -ne 1 || $1 =~ "[0-9]\{1,5\}" ]];
then
usage
else
CERT="fullchain.pem"
KEY="privkey.pem"
CONF="stunnel.conf"
THIS_CONF="stunnel.server.http.conf"
STARTSCRIPT="start_http_stunnel.sh"
DOCKERFILE="Dockerfile"
if [ -f $CERT -a -f $KEY -a -f $THIS_CONF ]; then
$SED "s/PORT/${1}/g" ${THIS_CONF} > ${CONF}
$SED -i "s/EXPOSE [0-9]\{1,5\}/EXPOSE ${1}/g" ${DOCKERFILE}
docker build -f ${DOCKERFILE} -t cmr_stunnel_http .
else
echo "http stunnel docker container build script:"
echo "Missing one of the following:"
echo "${CERT}, ${KEY}, ${THIS_CONF}"
echo ""
echo "Copy an example stunel configuration file, or use your own."
echo "Check /etc/letsencrypt/live/domain.com/ or /etc/ssl/ for certificates."
fi
fi