• Stars
    star
    159
  • Rank 227,737 (Top 5 %)
  • Language
    R
  • License
    Other
  • Created about 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy Dockerfile Creation from R

R-CMD-check Coverage status

{dockerfiler}

The goal of {dockerfiler} is to provide an easy way to create Dockerfiles from R.

About

You’re reading the doc about version :

desc::desc_get_version()
#> [1] '0.2.1'

The check results are:

devtools::check(quiet = TRUE)
#> β„Ή Loading dockerfiler
#> ── R CMD check results ────────────────────────────────── dockerfiler 0.2.1 ────
#> Duration: 48.4s
#> 
#> 0 errors βœ” | 0 warnings βœ” | 0 notes βœ”

Installation

You can install dockerfiler from GitHub with:

# install.packages("remotes")
remotes::install_github("ThinkR-open/dockerfiler")

Or from CRAN with :

install.packages("dockerfiler")

Basic worflow

By default, Dockerfiles are created with FROM "rocker/r-base".

You can set another FROM in new()

library(dockerfiler)
# Create a dockerfile template
my_dock <- Dockerfile$new()
my_dock$MAINTAINER("Colin FAY", "[email protected]")

Wrap your raw R Code inside the r() function to turn it into a bash command with R -e.

my_dock$RUN(r(install.packages("attempt", repo = "http://cran.irsn.fr/")))

Classical Docker stuffs:

my_dock$RUN("mkdir /usr/scripts")
my_dock$RUN("cd /usr/scripts")
my_dock$COPY("plumberfile.R", "/usr/scripts/plumber.R")
my_dock$COPY("torun.R", "/usr/scripts/torun.R")
my_dock$EXPOSE(8000)
my_dock$CMD("Rscript /usr/scripts/torun.R ")

See your Dockerfile :

my_dock

If you’ve made a mistake in your script, you can switch lines with the switch_cmd method. This function takes as arguments the positions of the two cmd you want to switch :

# Switch line 8 and 7
my_dock$switch_cmd(8, 7)
my_dock

You can also remove a cmd with remove_cmd:

my_dock$remove_cmd(8)
my_dock

This also works with a vector:

my_dock$remove_cmd(5:7)
my_dock

add_after add a command after a given line.

my_dock$add_after(
  cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
  after = 3
)

Save your Dockerfile:

my_dock$write()

Create a Dockerfile from a DESCRIPTION

You can use a DESCRIPTION file to create a Dockerfile that installs the dependencies and the package.

my_dock <- dock_from_desc("DESCRIPTION")
my_dock

my_dock$CMD(r(library(dockerfiler)))

my_dock$add_after(
  cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
  after = 3
)
my_dock

Create a Dockerfile from renv.lock

  • Create renv.lock
dir_build <- tempfile(pattern = "renv")
dir.create(dir_build)

# Create a lockfile
the_lockfile <- file.path(dir_build, "renv.lock")
custom_packages <- c(
  # attachment::att_from_description(),
  "renv",
  "cli",
  "glue",
  "golem",
  "shiny",
  "stats",
  "utils",
  "testthat",
  "knitr"
)
renv::snapshot(
  packages = custom_packages,
  lockfile = the_lockfile,
  prompt = FALSE
)
  • Build Dockerfile
my_dock <- dock_from_renv(
  lockfile = the_lockfile,
  distro = "focal",
  FROM = "rocker/verse"
)
my_dock

Contact

Questions and feedbacks welcome!

You want to contribute ? Open a PR :) If you encounter a bug or want to suggest an enhancement, please open an issue.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

More Repositories

1

golem

A Framework for Building Robust Shiny Apps
R
868
star
2

remedy

RStudio Addins to Simplify Markdown Writing
R
448
star
3

companies-using-r

A Curated list of R uses in entreprise
247
star
4

prepare-for-cran

A Collaborative list of things to know before submitting to CRAN
232
star
5

engineering-shiny-book

Engineering Production-Grade Shiny Apps β€” Published in the R Series
TeX
217
star
6

fusen

Inflate your package from a simple flat Rmd
R
148
star
7

fakir

Create Fake Data in R for tutorials
R
128
star
8

shinipsum

Lorem-Ipsum-like Helpers for fast Shiny Prototyping
R
115
star
9

attachment

Tools to deal with dependencies in scripts, Rmd and packages
R
104
star
10

shinysnippets

A series of shiny related RStudio Snippets
R
101
star
11

fcuk

A R package designed to help people with clumsy fingers.
R
89
star
12

wedding

Shiny app with custom css to prepare and manage a wedding
R
51
star
13

togglr

an R and Rstudio wrapper for toggl Api
R
46
star
14

devindocker

Development in a Docker container
R
37
star
15

gitlabr

An R client for the GitLab API
R
37
star
16

mariobox

A Framework For Packaging {plumber} APIs
R
37
star
17

seven31

R πŸ“¦ for R FAQ 7.31
R
36
star
18

checkhelper

A package to help deal with devtools::check outputs
R
34
star
19

gitdown

Document each modification of your software by turning your git commits into a gitbook
R
34
star
20

littleboxes

Rstudio Addin - create boxed title in an Rscript
R
33
star
21

licensing-r

A Bookdown about R & licenses
HTML
32
star
22

thinkr

Some tools for cleaning up messy 'Excel' files to be suitable for R
R
29
star
23

prompt

Dynamic prompt
R
28
star
24

testdown

Turn your 'testthat' results into a Bookdown.
R
26
star
25

prenoms

French Baby Names 1900-2020
R
23
star
26

ztype

How fast can you type R functions on your keyboard ?
R
23
star
27

tagsinput

Bootstrap tags input for shiny
R
20
star
28

tweetstorm

tweetstorm
R
19
star
29

utf8splain

Explain utf-8 encoded strings
R
18
star
30

js4shinyfieldnotes

Field Notes on JavaScript for Shiny Users
HTML
13
star
31

brighter

A toolbox of functions for easier shiny development.
R
12
star
32

who

Data from the World Health Organisation
R
12
star
33

rtodoist

Package to call the todoist API. Manage your ToDo lists with todoist from R.
R
11
star
34

papillon

Build And Highlight Package Documentation With Customized Templates
R
11
star
35

isc-proposal

RConsortium ISC Proposal β€” "Rebooting and Extending R for Neo4J"
9
star
36

bank

Alternative caching backends for `{memoise}` & `{shiny}`.
R
9
star
37

stopwords

stop words in several languages
R
9
star
38

prenomsapp

A Web App for French Baby Names
R
8
star
39

uni

unicode tibble
R
8
star
40

timer

A dead simple timer page written in JavaScript
TypeScript
8
star
41

shinidraw

R
7
star
42

arpr

Advanced R Pipes
R
7
star
43

datasets

Various datasets, free to use
R
6
star
44

elvis

'Shiny' renderers and observers made safer
R
6
star
45

spongecake

Transform a Movie into a Synthetic Picture.
R
6
star
46

golem-workshop

Repo for the Golem Workshop during ThinkR & RStudio Roadshow 2019
6
star
47

purrple

some html widgets
JavaScript
6
star
48

inca3

Jeux de donnΓ©es issu de l’étude de consommation alimentaire des franΓ§ais inca3 de l'ANSES
R
5
star
49

ghooks

'Golem' Hooks for Standard 'Shiny' Apps
R
5
star
50

rusk

Multiplication Tables On a Modular Circle
R
5
star
51

isc-proposal-licence

Licensing R - Guidelines and tools
5
star
52

prague

Where golems come to life
R
5
star
53

shinytodocx

POC permettant de montrer comment construire un rapport .docx Γ  partir d 'une application shiny
HTML
4
star
54

legislatives2017

RΓ©sultat des elections legislatives 2017
R
4
star
55

mongooser

A port of MongooseJS to R
R
4
star
56

signature

πŸ–ŠοΈ Fill in your email signature from a template
R
4
star
57

lozen

The objective of {lozen} is to centralize project management tools for Devs and Lead Devs.
R
4
star
58

tutor

R
4
star
59

thinkrdashboard

State of ThinkR open-source projects
R
4
star
60

w3css

[WIP] Implementation of W3.CSS for {shiny}
R
4
star
61

googlefonts

using google fonts in shiny applications
R
3
star
62

clientapp

Showcase of Shiny App for client database and after-sales calls exploration
R
3
star
63

installR

script d'installation de configuration de R
R
3
star
64

rstudioconf2019

An e-poster given during the rstudio::conf(2019).
3
star
65

docker4dev

Repository with DockerFiles for tutorials
R
2
star
66

architekter

A tool to extract a {ggplot2} theme from a Figma file
R
2
star
67

golemverse.org

golemverse
JavaScript
2
star
68

golemstream

Streams by the {golem} team
HTML
2
star
69

bookshiny

R
2
star
70

ipsum

dummy text generator
R
2
star
71

fa

font awesome R tools
R
2
star
72

gemstones

Make Your 'golem' App Shine
R
2
star
73

rfrance

Aggregation de blog sur #rstats en πŸ‡«πŸ‡·
CSS
2
star
74

activecollabr

Access the active collab API from R.
R
2
star
75

abcdR

1
star
76

thinkr-hex-stickers

HQ hex and visuals for ThinkR projects
1
star
77

thinkrtemplate

A pkgdown template for ThinkR packages
CSS
1
star
78

axonaut

axonaut API for R
R
1
star
79

golem-paper

Repo for a paper about golem
1
star
80

cranology

R
1
star
81

tetraclasse

Satisfaction analysis - LLosa matrix - Tetraclasse model
R
1
star
82

emojitsu

Emoji Grammar
R
1
star
83

example.auto

Repository for automatic repo management tests
R
1
star
84

thinkr-open.r-universe.dev

Packages for the ThinkR Universe
1
star
85

quakr

🌈 Quakr formats for revealjs
SCSS
1
star
86

blogs-comments

Comments on our blog posts with Utterances
1
star
87

iframe.illustrations

Some iframe for our blog posts on thinkr.fr
HTML
1
star
88

slack

slack API for R
R
1
star
89

meetup-r

Meetup "R, vous avez dit R ?"
1
star