---
output: rmarkdown::html_vignette
title: Docker file
vignette: >
%\VignetteIndexEntry{Docker file}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
# Docker file
The rco Docker image will optimize any CRAN package, using the latest GitHub `rco` stable version.
If the package to optimize has a `testthat` suite, then it will test the original and optimized versions, and show the obtained speed-up.
## Installation
First, you need to install [Docker](https://www.docker.com/) on your computer.
And then, from a terminal, the `rco` Docker image can be pulled from [Docker Hub](https://hub.docker.com/r/jcrodriguez1989/rco) with:
```{bash eval=FALSE}
docker pull jcrodriguez1989/rco
```
## Usage
The docker image basic usage will optimize a random CRAN package, this is done with:
```{bash eval=FALSE}
docker run jcrodriguez1989/rco
```
We can also specify a package to optimize, using the `RCO_PKG` environment variable, for example, if we want to optimize the `rflights` package:
```{bash eval=FALSE}
docker run -e RCO_PKG=rflights jcrodriguez1989/rco
```
Also, if we want to get the resulting optimized files we can set a docker shared folder, with:
```{bash eval=FALSE}
# Replace DEST_FOLDER path, with your desired output path
DEST_FOLDER=/tmp/rco_dock_res
docker run -v $DEST_FOLDER:/rco_results jcrodriguez1989/rco
```
**In summary**, if we want to optimize the `rflights` package and save its results, we can do:
```{bash eval=FALSE}
docker run -e RCO_PKG=rflights -v $DEST_FOLDER:/rco_results jcrodriguez1989/rco
```
And in the `DEST_FOLDER` we will have files as:
```{bash eval=FALSE}
ls $DEST_FOLDER
## rflights rflights_0.1.0.tar.gz rflights_opt
```