Created
March 30, 2017 08:27
-
-
Save MatteoRagni/861a46589c6a45a8d325522046cb4db9 to your computer and use it in GitHub Desktop.
VBOX building environment
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
FROM debian:7.11 | |
LABEL Description "Building Machine for VBox" | |
LABEL Vendor "Matteo Ragni, Alessandro Mazzalai" | |
LABEL Mantainer "[email protected]" | |
LABEL Version "1.0" | |
RUN apt-get update | |
RUN apt-get install -y --no-upgrade --no-install-recommends \ | |
build-essential \ | |
clang \ | |
cmake \ | |
ruby | |
RUN mkdir /src | |
WORKDIR /src | |
CMD /bin/bash |
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/bash | |
__vboxenvstart__() { | |
docker run --name vbox-env-machine -d -v $(pwd):/src matteoragni/vbox-env tail -f /dev/null | |
} | |
__vboxenvstop__() { | |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=<vbox-env-machine> --format="{{.ID}}")) | |
} | |
__vboxenvrun__() { | |
echo "runs: $@" | |
docker run -it -v $(pwd):/src matteoragni/vbox-env bash -c "$@" | |
} | |
__vboxenvexec__() { | |
docker exec -it vbox-env-machine bash -c "$@" | |
} | |
vboxenv() { | |
case $1 in | |
help) | |
echo "VBOX ENVIRONMENT" | |
echo " vboxenv help: shows this help" | |
echo " vboxenv start: starts the docker container" | |
echo " vboxenv stop: stops and remove the docker container" | |
echo " vboxenv exec ...: commands are passed directly to the container. Must be started first." | |
echo " vboxenv ...: starts, runs and stops commands." | |
;; | |
start) | |
__vboxenvstart__ | |
;; | |
stop) | |
__vboxenvstop__ | |
;; | |
exec) | |
__vboxenvexec__ "$@" | |
;; | |
*) | |
__vboxenvrun__ "$@" | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment