Skip to content

Commit

Permalink
Use correct volume mapping for inplace containers
Browse files Browse the repository at this point in the history
Re: #20
  • Loading branch information
richfitz committed Sep 8, 2015
1 parent 8d97527 commit 0b6df0d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions R/dockertest.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ dockertest_names <- function(filename=NULL) {
##' command string suitable for running in a separate script.
##' @param mount_volume Should a volume be mounted? This generates
##' the appropriate \emph{absolute} path name for a mapping. By
##' default this is \code{TRUE} if the image requires it.
##' default this is \code{TRUE} if the image requires it. If the
##' image is "inplace", the the mount will map the project root to
##' the docker working directory. If not then it will mount the
##' `self` directory (a clean clone) into the place where that is
##' re-cloned into the container (therefore isolated from the
##' machine). This behaviour may change.
##' @param machine Name of docker machine to use
##' @param name As an alternative to \code{type}, a full name can be
##' given here, which dockertest will attempt to map onto a type.
Expand Down Expand Up @@ -357,7 +362,16 @@ launch <- function(type="test", args=NULL, interactive=TRUE, dry_run=FALSE,
mount_volume <- info$local_filesystem
}
if (mount_volume) {
volume_map <- c("-v", sprintf("%s:/src", info$path_project))
if (info$inplace) {
src <- info$path_project
dest <- file.path("/root", info$name)
} else {
## TODO: I don't know if this is always correct:
path_dockertest <- dirname(dockertest_path(filename, TRUE))
src <- file.path(getwd(), path_dockertest, "self")
dest <- "/src"
}
volume_map <- c("-v", sprintf("%s:%s", src, dest))
} else {
volume_map <- character(0)
}
Expand Down

0 comments on commit 0b6df0d

Please sign in to comment.