---
title: "Development in Docker"
author: "Sébatsien Rochette"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{ad-dev-in-docker}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

<script type="text/javascript">
$(document).ready(function () {
  window.initializeCodeFolding("show" === "show");
});
</script>

```{r setup, include=FALSE}
knitr::opts_chunk$set(
  echo = TRUE
)

library(devindocker)
```

## Create new package

You can use {devindocker} for any directory, project or even package. In the end, these are all folders on your computer.
```{r}
tempdir <- tempdir()
my_project <- normalizePath(file.path(tempdir, "myproject"), mustWork = FALSE)
usethis::create_package(my_project, open = FALSE)
```

## Launch Docker
```{r, eval=FALSE}
# path <- "" # default
path <- my_project

# Which container with RStudio server? ----
container <- "rocker/geospatial:4.0.1"

# Which port ? ----
# _Useful if multiple Rstudio Server to launch
port <- 8788

# Start Docker project
launch_proj_docker(path = path,
                   container = container,
                   port = port)

# Stop Docker properly
stop_proj_docker(path = path, sleep = 5)
```


