Open benmarwick opened 4 years ago
You can add instructions manually, but they will be added "at the end" of all instructions:
addInstruction(df_description) <- Run(
exec = "R",
params = c("-e", "devtools::install_github('trinker/pacman'); devtools::install('/compendium', dep=TRUE)"))
> print(df_description)
FROM rocker/verse:3.6.2
LABEL maintainer="daniel"
# CRAN packages skipped because they are in the base image:
RUN ["install2.r", "compendium", "here"]
WORKDIR compendium/
COPY ["./", "./"]
RUN ["R", "-e", "devtools::install_github('trinker/pacman'); devtools::install('/compendium', dep=TRUE)"]
CMD ["R"]
Run_shell
supports multiple commands if you are keen on reducing the number of RUN
instructions:
> addInstruction(df_description) <- Run_shell(c("R -e \"devtools::install_github('trinker/pacman'); devtools::install('/compendium', dep=TRUE)\"",
+ "R -e \"devtools::check('/compendium',error_on = 'error')\""))
> print(df_description)
FROM rocker/verse:3.6.2
LABEL maintainer="daniel"
# CRAN packages skipped because they are in the base image:
RUN ["install2.r", "compendium", "here"]
WORKDIR compendium/
COPY ["./", "./"]
RUN ["R", "-e", "devtools::install_github('trinker/pacman'); devtools::install('/compendium', dep=TRUE)"]
RUN R -e "devtools::install_github('trinker/pacman'); devtools::install('/compendium', dep=TRUE)" \
&& R -e "devtools::check('/compendium',error_on = 'error')"
CMD ["R"]
I'd be open to add another constructor function that does something similar for a given executable to make the escaping less of a hassle, e.g. Run(exec = "R", params = list(c("-e", "..."), c("-e", "another...")))
?
_Would you prefer an parameter extra_instructions
as part of the dockerfile(..)
function?_
I can only see an option to use
CMD
incontainerit::dockerfile()
, how can I write a dockerfile that runs things using containerit::dockerfile()?Like this, for example, where I can install some pkgs and render the Rmd file while building the Docker container. I like this because then
docker build
becomes a kind-of code quality check for the Rmd file. Can we get the RUN argument fully exposed in the R function?