| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | #$1 is the container name |
| 3 | |
| 4 | checkForCppUTestToolsEnvVariablescip-shell shell cpputest 4.0-3 checkForCppUTestToolsEnvVariable().() { |
| 5 | if [scip-shell system . . `[`. -z "$CPPUTEST_HOME" ] ; then |
| 6 | echoscip-shell system . . echo. "CPPUTEST_HOME not set. You must set CPPUTEST_HOME to the top level CppUTest directory" |
| 7 | exit 1 |
| 8 | fi |
| 9 | if [scip-shell system . . `[`. ! -d "$CPPUTEST_HOME" ] ; then |
| 10 | echoscip-shell system . . echo. "CPPUTEST_HOME not set to a directory. You must set CPPUTEST_HOME to the top level CppUTest directory" |
| 11 | exit 2 |
| 12 | fi |
| 13 | } |
| 14 | |
| 15 | checkForImageNameParameterscip-shell shell cpputest 4.0-3 checkForImageNameParameter().() { |
| 16 | if [scip-shell system . . `[`. -z "$container" ] ; then |
| 17 | echoscip-shell system . . echo. "Container name parameter not set. Check the docker directory. It should be the extension of the Dockerfile. e.g. ubuntu" |
| 18 | exit 1 |
| 19 | fi |
| 20 | if [scip-shell system . . `[`. ! -f "$CPPUTEST_HOME/docker/Dockerfile.$container" ] ; then |
| 21 | echoscip-shell system . . echo. "The Dockerfile docker/Dockerfile.$container doesn't exist. Typo?" |
| 22 | exit 2 |
| 23 | fi |
| 24 | } |
| 25 | |
| 26 | |
| 27 | container=$1 |
| 28 | checkForCppUTestToolsEnvVariablescip-shell shell cpputest 4.0-3 checkForCppUTestToolsEnvVariable(). |
| 29 | checkForImageNameParameterscip-shell shell cpputest 4.0-3 checkForImageNameParameter(). |
| 30 | |
| 31 | docker build -f $CPPUTEST_HOME/docker/Dockerfile.$container --tag cpputest/$container:latest . |
| 32 | docker container rm cpputest_$container |
| 33 | docker create -it -v$CPPUTEST_HOME:/cpputest -e "CPPUTEST_HOME=/cpputest" --name cpputest_$container cpputest/$container:latest |
| 34 | |
| 35 | echoscip-shell system . . echo. "You can run your container through: docker start -i cpputest_<container>. E.g. docker start -i cpputest_$container" |
| 36 | |
| 37 |