% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate-dockerfile.R
\name{generate_dockerfile}
\alias{generate_dockerfile}
\title{Generate a reproducible Dockerfile for an R project}
\usage{
generate_dockerfile(
  verbose = FALSE,
  r_version = "current",
  data_file = NULL,
  code_file = NULL,
  misc_file = NULL,
  add_user = NULL,
  home_dir = "/home",
  install_quarto = FALSE,
  expose_port = "8787",
  r_mode = "base",
  install_syslibs = TRUE,
  comments = FALSE,
  output = tempdir()
)
}
\arguments{
\item{verbose}{Logical. If \code{TRUE}, prints progress messages as each section
of the Dockerfile is written. Defaults to \code{FALSE}.}

\item{r_version}{A character string specifying the R version to use, e.g.
\code{"4.3.0"}. Defaults to \code{"current"}, which resolves to the version of R
running in the current session.}

\item{data_file}{A character string. Path to an optional data file to copy
into the container under \verb{/home/data/}. Defaults to \code{NULL}.}

\item{code_file}{A character string. Path to an optional script file (e.g.
\code{.R}, \code{.qmd}, \code{.rmd}) to copy into the container under \verb{/home/}.
Defaults to \code{NULL}.}

\item{misc_file}{A character string. Path to an optional miscellaneous file
(e.g. an image or shell script) to copy into the container under
\verb{/home/}. Defaults to \code{NULL}.}

\item{add_user}{A character string. Name of a Linux user to create inside
the container with sudo access. Defaults to \code{NULL}.}

\item{home_dir}{A character string. The working directory set inside the
container via \code{WORKDIR}. Defaults to \code{"/home"}.}

\item{install_quarto}{Logical. If \code{TRUE}, downloads and installs the Quarto
CLI inside the container. Defaults to \code{FALSE}.}

\item{expose_port}{A character string. The port to expose when \code{r_mode} is
\code{"rstudio"}. Defaults to \code{"8787"}.}

\item{r_mode}{A character string selecting the Rocker base image. Inspired
by the \href{https://rocker-project.org/}{Rocker Project}. One of \code{"base"} for
plain R, \code{"tidyverse"} for R with the tidyverse, \code{"rstudio"} for RStudio
Server, or \code{"tidystudio"} for tidyverse plus TeX Live and
publishing-related packages. Defaults to \code{"base"}.}

\item{install_syslibs}{Logical. If \code{TRUE}, installs system libraries
commonly required by R packages and needed for source compilation
(e.g. \code{libcurl4-openssl-dev}, \code{libxml2-dev}). Defaults to \code{TRUE}.}

\item{comments}{Logical. If \code{TRUE}, annotates each Dockerfile instruction
with an explanatory comment. Useful for learning or sharing. Defaults to
\code{FALSE}.}

\item{output}{A character string. Directory path where the \code{Dockerfile} will
be written. Defaults to \code{tempdir()}.}
}
\value{
Called for its side effects. Writes a \code{Dockerfile} to \code{output}.
Does not return a value.
}
\description{
\code{generate_dockerfile()} inspects an R project's dependencies via an \code{renv}
lockfile and writes a ready-to-use \code{Dockerfile} to the specified output
directory. It supports multiple Rocker base images, optional system
libraries, Quarto installation, file copying, user creation, and inline
documentation comments.
}
\examples{
# Generate a minimal Dockerfile using a pinned R version
generate_dockerfile(r_version = "4.4.0", output = tempdir())

# Pin a specific R version with the tidyverse image
generate_dockerfile(r_version = "4.3.0", r_mode = "tidyverse", output = tempdir())

# Include a data file and annotate the Dockerfile with comments
\dontrun{
generate_dockerfile(
  r_version = "4.3.0",
  data_file = "data/penguins.csv",
  comments  = TRUE,
  output    = "."
)
}

}
