{"id":20665609,"url":"https://github.com/thinkr-open/dockerfiler","last_synced_at":"2025-04-04T08:10:08.127Z","repository":{"id":37481561,"uuid":"120228699","full_name":"ThinkR-open/dockerfiler","owner":"ThinkR-open","description":"Easy Dockerfile Creation from R","archived":false,"fork":false,"pushed_at":"2024-08-12T08:46:29.000Z","size":199,"stargazers_count":176,"open_issues_count":22,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-07T15:02:15.303Z","etag":null,"topics":["golemverse","hacktoberfest","hacktoberfest-accepted"],"latest_commit_sha":null,"homepage":"https://thinkr-open.github.io/dockerfiler/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThinkR-open.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-04T22:22:00.000Z","updated_at":"2024-09-07T07:33:33.000Z","dependencies_parsed_at":"2023-02-10T14:00:53.977Z","dependency_job_id":"1b9677cb-ef72-4a7e-934f-4eff16093559","html_url":"https://github.com/ThinkR-open/dockerfiler","commit_stats":{"total_commits":57,"total_committers":10,"mean_commits":5.7,"dds":"0.42105263157894735","last_synced_commit":"e40f804e9728afb9bb5a8c52d965c9ac4a8fd58a"},"previous_names":["colinfay/dockerfiler"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fdockerfiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fdockerfiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fdockerfiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fdockerfiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThinkR-open","download_url":"https://codeload.github.com/ThinkR-open/dockerfiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142074,"owners_count":20890653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golemverse","hacktoberfest","hacktoberfest-accepted"],"created_at":"2024-11-16T19:32:43.682Z","updated_at":"2025-04-04T08:10:08.087Z","avatar_url":"https://github.com/ThinkR-open.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  eval = FALSE,\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/ThinkR-open/dockerfiler/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/dockerfiler/actions)\n[![Coverage status](https://codecov.io/gh/ThinkR-open/dockerfiler/branch/master/graph/badge.svg)](https://app.codecov.io/github/ThinkR-open/dockerfiler?branch=master)\n\u003c!-- badges: end --\u003e\n\n\n# `{dockerfiler}`\n\nThe goal of `{dockerfiler}` is to provide an easy way to create Dockerfiles from R.\n\n## About\n\nYou're reading the doc about version :\n\n```{r eval = TRUE}\ndesc::desc_get_version()\n```\n\nThe check results are:\n\n```{r eval = TRUE}\ndevtools::check(quiet = TRUE)\n```\n\n## Installation\n\nYou can install dockerfiler from GitHub with:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"ThinkR-open/dockerfiler\")\n```\n\nOr from CRAN with :\n\n```{r, eval = FALSE}\ninstall.packages(\"dockerfiler\")\n```\n\n## Basic worflow\n\nBy default, Dockerfiles are created with `FROM \"rocker/r-base\"`.\n\nYou can set another FROM in `new()`\n\n```{r}\nlibrary(dockerfiler)\n# Create a dockerfile template\nmy_dock \u003c- Dockerfile$new()\nmy_dock$MAINTAINER(\"Colin FAY\", \"contact@colinfay.me\")\n```\n\nWrap your raw R Code inside the `r()` function to turn it into a bash command with `R -e`.\n\n```{r}\nmy_dock$RUN(r(install.packages(\"attempt\", repo = \"http://cran.irsn.fr/\")))\n```\n\nClassical Docker stuffs:\n\n```{r}\nmy_dock$RUN(\"mkdir /usr/scripts\")\nmy_dock$RUN(\"cd /usr/scripts\")\nmy_dock$COPY(\"plumberfile.R\", \"/usr/scripts/plumber.R\")\nmy_dock$COPY(\"torun.R\", \"/usr/scripts/torun.R\")\nmy_dock$EXPOSE(8000)\nmy_dock$CMD(\"Rscript /usr/scripts/torun.R \")\n```\n\nSee your Dockerfile :\n\n```{r}\nmy_dock\n```\n\nIf 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 :\n\n```{r}\n# Switch line 8 and 7\nmy_dock$switch_cmd(8, 7)\nmy_dock\n```\n\nYou can also remove a cmd with `remove_cmd`:\n\n```{r}\nmy_dock$remove_cmd(8)\nmy_dock\n```\n\nThis also works with a vector:\n\n```{r}\nmy_dock$remove_cmd(5:7)\nmy_dock\n```\n\n`add_after` add a command after a given line.\n\n```{r}\nmy_dock$add_after(\n  cmd = \"RUN R -e 'remotes::install_cran(\\\"rlang\\\")'\",\n  after = 3\n)\n```\n\n\nSave your Dockerfile:\n\n```{r eval = FALSE}\nmy_dock$write()\n```\n\n## Create a Dockerfile from a DESCRIPTION\n\nYou can use a DESCRIPTION file to create a Dockerfile that installs the dependencies and the package.\n\n```{r}\nmy_dock \u003c- dock_from_desc(\"DESCRIPTION\")\nmy_dock\n\nmy_dock$CMD(r(library(dockerfiler)))\n\nmy_dock$add_after(\n  cmd = \"RUN R -e 'remotes::install_cran(\\\"rlang\\\")'\",\n  after = 3\n)\nmy_dock\n```\n\n## Create a Dockerfile from renv.lock\n\n- Create renv.lock\n```{r, message=FALSE, results='hide'}\ndir_build \u003c- tempfile(pattern = \"renv\")\ndir.create(dir_build)\n\n# Create a lockfile\nthe_lockfile \u003c- file.path(dir_build, \"renv.lock\")\ncustom_packages \u003c- c(\n  # attachment::att_from_description(),\n  \"renv\",\n  \"cli\",\n  \"glue\",\n  \"golem\",\n  \"shiny\",\n  \"stats\",\n  \"utils\",\n  \"testthat\",\n  \"knitr\"\n)\nrenv::snapshot(\n  packages = custom_packages,\n  lockfile = the_lockfile,\n  prompt = FALSE\n)\n```\n\n- Build Dockerfile\n```{r}\nmy_dock \u003c- dock_from_renv(\n  lockfile = the_lockfile,\n  distro = \"focal\",\n  FROM = \"rocker/verse\"\n)\nmy_dock\n```\n\n## Contact\n\nQuestions and feedbacks [welcome](mailto:contact@colinfay.me)!\n\nYou want to contribute ? Open a [PR](https://github.com/ThinkR-open/dockerfiler/pulls) :) If you encounter a bug or want to suggest an enhancement, please [open an issue](https://github.com/ThinkR-open/dockerfiler/issues).\n\nPlease note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).\nBy participating in this project you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkr-open%2Fdockerfiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkr-open%2Fdockerfiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkr-open%2Fdockerfiler/lists"}