Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added copy export, to fix #171 #190

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5ab8f59
added copy export, to fix #171
muschellij2 Oct 8, 2021
6c1891b
addedthe ability to pass in instructions on dockerfile creation
muschellij2 Oct 8, 2021
db58b01
fixing bugs for make_unit (deprecated), and expression parsing (bioc.…
muschellij2 Oct 11, 2021
0d19711
fixing warning in LabelelSchema, added potential fix for BioC
muschellij2 Oct 11, 2021
f245b98
exporting Workdir similar to Copy
muschellij2 Oct 11, 2021
8386bbc
fixing units package again for test_package_script
muschellij2 Oct 11, 2021
a8042f0
added ability to run docker commands for check by adding GitHub Actions
muschellij2 Oct 11, 2021
d6f4691
updated te readme !! microbadger isnt a thing anymore
muschellij2 Oct 11, 2021
81680d5
fixing typo
muschellij2 Oct 13, 2021
4a12c25
fixing issue if platform is null with sysreqs api
muschellij2 Oct 13, 2021
c28e12b
added session_info capabilities
muschellij2 Oct 14, 2021
2b48c0c
added the platform argument to be able to pass through
muschellij2 Oct 14, 2021
3573184
bug/typo
muschellij2 Oct 14, 2021
31cf167
adding docker to gh actions
muschellij2 Oct 14, 2021
86255b4
fixing actions
muschellij2 Oct 14, 2021
2af23e3
trying agian
muschellij2 Oct 14, 2021
ba4daa6
trying agian
muschellij2 Oct 14, 2021
a76cdd3
added the skip for coxrobust
muschellij2 Oct 14, 2021
235f09f
allowing ubuntu in there because sysreqs supports it
muschellij2 Oct 14, 2021
8527cb5
trying to fix #193
muschellij2 Nov 19, 2021
21ff490
removed hash
muschellij2 Nov 19, 2021
8822aff
jsonlite can take care of the hash
muschellij2 Nov 19, 2021
0f7aaf4
addedd Arg and Env arguments
muschellij2 Nov 30, 2021
31175cf
fixing some of the tests
muschellij2 Nov 30, 2021
ab2e804
added in syntax
muschellij2 Dec 2, 2021
e27a175
Fix doc comment
nuest Dec 17, 2021
5bd7c4f
Added CMD_Rexpr
muschellij2 Feb 8, 2022
e5c11df
Merge branch 'master' of github.com:muschellij2/containerit
muschellij2 Feb 8, 2022
04731e9
allowed Cmd to be NULL
muschellij2 Feb 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Imports:
versions
Suggests:
BiocGenerics,
units (>= 0.7.0),
codetools,
covr,
coxrobust,
Expand Down Expand Up @@ -97,7 +98,7 @@ Remotes:
github::r-hub/sysreqs
Encoding: UTF-8
LazyData: TRUE
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Collate:
'Class-Instruction.R'
'Class-Add.R'
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(CMD_Render)
export(CMD_Rscript)
export(Cmd)
export(Comment)
export(Copy)
export(Entrypoint)
export(Expose)
export(Label)
Expand Down
2 changes: 1 addition & 1 deletion R/Class-Cmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' See official documentation at \url{https://docs.docker.com/engine/reference/builder/#cmd}.
#'
#' @slot exec exectuable, character
#' @slot exec executable, character
#' @slot params parameters, character (vector)
#' @slot form the form to use for output (exec or shell)
#'
Expand Down
2 changes: 2 additions & 0 deletions R/Class-Copy.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' @family instruction classes
#' @examples
#' #no example yet
#' Copy("here", "/here")
setClass("Copy",
slots = list(src = "character", dest = "character"),
contains = "Instruction")
Expand All @@ -26,6 +27,7 @@ setClass("Copy",
#' @param addTrailingSlashes (boolean) add trailing slashes to the given paths if the source is an existing directory
#'
#' @return the object
#' @export
#' @importFrom fs dir_exists
#' @importFrom stringr str_detect
Copy <- function(src, dest, addTrailingSlashes = TRUE) {
Expand Down
4 changes: 3 additions & 1 deletion R/dockerfile.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#' @param soft (boolean) Whether to include soft dependencies when system dependencies are installed, default is no.
#' @param offline (boolean) Whether to use an online database to detect system dependencies or use local package information (slower!), default is no.
#' @param copy whether and how a workspace should be copied; allowed values: "script", "script_dir" (paths relative to file, so only works for file-base \code{from} inputs, which (can be nested) within current working directory), a list of file paths relative to the current working directory to be copied into the payload directory, or \code{NULL} to disable copying of files
#' @param instructions an ordered list of instructions in the Dockerfile
#' @param container_workdir the working directory in the container, defaults to \code{/payload/} and must end with \code{/}. Can be skipped with value \code{NULL}.
#' @param cmd The CMD statement that should be executed by default when running a parameter. Use \code{CMD_Rscript(path)} in order to reference an R script to be executed on startup, \code{CMD_Render(path)} to render an R Markdown document, or \code{Cmd(command)} for any command. If \code{character} is provided it is passed wrapped in a \code{Cmd(command)}.
#' @param entrypoint the ENTRYPOINT statement for the Dockerfile
Expand Down Expand Up @@ -73,6 +74,7 @@ dockerfile <- function(from = utils::sessionInfo(),
soft = FALSE,
offline = FALSE,
copy = NULL,
instructions = list(),
# nolint start
container_workdir = "/payload/",
# nolint end
Expand Down Expand Up @@ -141,7 +143,7 @@ dockerfile <- function(from = utils::sessionInfo(),

# base dockerfile
the_dockerfile <- methods::new("Dockerfile",
instructions = list(),
instructions = instructions,
maintainer = maintainer,
image = image,
entrypoint = entrypoint,
Expand Down
8 changes: 8 additions & 0 deletions R/utility-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ getImageForVersion <- function(r_version, nearest = TRUE) {
if (nearest) {
# get numeric versions with all parts (maj.min.minor), i.e. two dots
numeric_tags <- tags[which(grepl("\\d.\\d.\\d", tags))]
# issue is cuda/ubuntu
numeric_tags <- numeric_tags[!grepl("[[:alpha:]]", numeric_tags)]
closest <- as.character(closestMatch(r_version, numeric_tags))
image <- From(.rocker_images[["versioned"]], tag = closest)

Expand Down Expand Up @@ -423,6 +425,12 @@ clean_session <- function(expr = c(),

futile.logger::flog.debug("Creating an R session with the following expressions:\n%s", toString(expr))

if (is.call(expr)) {
# so functions such as
# containerit::clean_session(expr = quote(library("BiocGenerics")))
# still work
expr = c(expr)
}
the_info <- callr::r_vanilla(function(expressions) {
for (e in expressions) {
eval(e)
Expand Down
2 changes: 1 addition & 1 deletion man/Cmd-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/Copy-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/dockerfile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here is an example using `mtcars`. First, we specify the imperial units to those

```{r}
library(units)
gallon = make_unit("gallon")
gallon = as_units("gallon")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consumption = mtcars$mpg * with(ud_units, mi/gallon)
displacement = mtcars$disp * ud_units[["in"]]^3
```
Expand Down
2 changes: 1 addition & 1 deletion vignettes/bioconductor.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ df <- dockerfile(from = info)
A shortcut to this is provided with the function `containerit::clean_session(..)`:

```{r bioc_dockerfile_clean_session, results='hide'}
containerit::clean_session(expr = quote(library("BiocGenerics")))
containerit::clean_session(expr = c(quote(library("BiocGenerics"))))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first still should work (hence the fix above), but figured the vignette should show the "right" way to do it.

```


Expand Down