email/cypht2/build_and_run.sh

31 lines
629 B
Bash
Executable File

#! /bin/bash
set -e
set -u
cd "$(dirname "${BASH_SOURCE[0]}")"
name="$(basename "$(pwd)")"
dir="$(pwd)"
pushd $GOPATH/src/local/rproxy3
CGO_ENABLED=0 GOOS=linux go build -o "$dir/mnt/proxy" -a -installsuffix cgo
popd
#img="php"
#tag="7.1.26-alpine3.9"
#docker pull $img:$tag
docker build -t $name:latest .
mkdir -p ./mnt
cp ./entrypoint.sh ./mnt/
docker run --rm -it \
--entrypoint sh \
--name $name \
-p 8346:8081 \
-v $(pwd)/mnt:/mnt \
$name:latest \
/mnt/entrypoint.sh \
-p 8081 -burst 100 -crt /mnt/server.crt -key /mnt/server.key -r localhost:http://localhost:8080 -rate 100 -timeout 30 \
"$@"