Created
November 11, 2015 12:16
-
-
Save mfojtik/f89b13e49c740920365c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
base_dir="$(dirname "${0}")/.." | |
binary_dir=$(mktemp -d --suffix=s2i-wine) | |
cidfile=$(mktemp -u --suffix=s2i-wine.cid) | |
function prepare_window_binary { | |
set -e | |
pushd ${base_dir}/_output/local/releases >/dev/null | |
source_archive=$(ls *-windows-amd64*) | |
unzip -qq ${source_archive} -d ${binary_dir}/ | |
popd >/dev/null | |
set +e | |
} | |
function create_wine_container { | |
volume="-v ${binary_dir}:/test:z" | |
docker run --cidfile=${cidfile} -d ${volume} -e WINEDEBUG=fixme-all,err-all,warn-all \ | |
--privileged -v /var/run/docker.sock:/var/run/docker.sock:z \ | |
--workdir /test -e DOCKER_TLS=0 -e DOCKER_HOST=tcp://127.0.0.1:50333 \ | |
--net host -p 50333:50333 \ | |
--name "s2i-wine" tianon/wine:64 /bin/sleep infinity | |
# Install git for s2i | |
echo "Installing git and socat ..." | |
docker exec s2i-wine apt-get -qq -y install git socat >/dev/null | |
# Starting socat | |
echo "Forwarding unix:///var/run/docker.sock -> tcp://0.0.0.0:50333 ..." | |
docker exec s2i-wine socat -vv -x TCP-LISTEN:50333,reuseaddr,fork \ | |
UNIX-CONNECT:/var/run/docker.sock & | |
# Initialize the wine server to have less warnings later | |
run_s2i &>/dev/null | |
echo "The wine container is ready ..." | |
} | |
function run_s2i { | |
docker exec s2i-wine wine64 /test/s2i.exe --loglevel=5 "$@" | |
} | |
function cleanup { | |
echo "Cleaning up ..." | |
docker kill $(cat ${cidfile}) | |
docker rm s2i-wine | |
rm -rf ${binary_dir} | |
rm -rf ${cidfile} | |
} | |
prepare_window_binary | |
create_wine_container | |
run_s2i build git://github.com/openshift/ruby-hello-world centos/ruby-22-centos7 hello-world-app | |
cleanup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment