Skip to content

Commit 6833d72

Browse files
committed
README Touchup
1 parent 3fe1b88 commit 6833d72

File tree

3 files changed

+202
-45
lines changed

3 files changed

+202
-45
lines changed

LICENSE

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.Rmd

Lines changed: 109 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,134 @@ knitr::opts_chunk$set(
1313
)
1414
```
1515

16-
# shinydocker
16+
17+
> [!IMPORTANT]
18+
>
19+
> This package is currently in the prototype/experimental stage. It is not yet
20+
> available on CRAN and may have bugs or limitations.
21+
22+
# shinydocker <img src="man/figures/shinydocker-animated-logo.svg" align="right" height="139" />
1723

1824
<!-- badges: start -->
25+
[![R-CMD-check](https://github.com/coatless-rpkg/shinydocker/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/shinydocker/actions/workflows/R-CMD-check.yaml)
26+
![Prototype](https://img.shields.io/badge/Status-Prototype-orange)
27+
![Experimental](https://img.shields.io/badge/Status-Experimental-blue)
1928
<!-- badges: end -->
2029

21-
The goal of shinydocker is to ...
30+
`shinydocker` is an R package that streamlines the process of containerizing Shiny applications, supporting both R and Python Shiny apps.
2231

2332
## Installation
2433

25-
You can install the development version of shinydocker from [GitHub](https://github.com/) with:
34+
You can install the development version of `shinydocker` from GitHub with:
35+
36+
```{r}
37+
#| label: install-shinydocker
38+
#| eval: false
39+
# install.packages("remotes")
40+
remotes::install_github("coatless-rpkg/shinydocker")
41+
```
42+
43+
You will also need to have Docker installed on your system. You can download Docker from the [official website](https://www.docker.com/products/docker-desktop). You do not need to
44+
log in to Docker to use `shinydocker`.
45+
46+
## Using shinydocker
47+
48+
The package provides a set of functions to automate the process, as well as options for advanced configuration.
2649

27-
``` r
28-
# install.packages("pak")
29-
pak::pak("coatless-rpkg/shinydocker")
50+
### Exporting a Shiny App to Docker
51+
52+
The `export()` function allows you to convert a Shiny application into a docker
53+
containerized application.
54+
55+
```{r}
56+
#| label: export-shiny-app-to-docker-generic
57+
#| eval: false
58+
# Automated export: configures, builds, and optionally runs the container
59+
export("path/to/your/shinyapp", run = TRUE)
3060
```
3161

32-
## Example
62+
For example, to convert the "Hello World" Shiny app from the `{shiny}` package
63+
into a standalone Electron app:
3364

34-
This is a basic example which shows you how to solve a common problem:
65+
```{r}
66+
#| label: export-shiny-app-to-docker-hello-world
67+
#| eval: false
68+
# Copy "Hello World" from `{shiny}`
69+
system.file("examples", "01_hello", package="shiny") |>
70+
fs::dir_copy("myapp", overwrite = TRUE)
71+
72+
shinydocker::export("myapp", run = TRUE)
73+
```
3574

36-
```{r example}
75+
76+
### Manually Dockerizing a Shiny App
77+
78+
```{r}
79+
#| label: dockerize-a-shiny-app
80+
#| eval: false
3781
library(shinydocker)
38-
## basic example code
82+
83+
# Path to your Shiny app
84+
shiny_app_path <- "path/to/your/shinyapp"
85+
86+
# Create Docker configuration for a Shiny app
87+
dockerize(shiny_app_path)
88+
89+
# Build a Docker image
90+
build_image(shiny_app_path)
91+
92+
# Run the container
93+
run_container(shiny_app_path)
94+
```
95+
96+
### Diagnostic Tools
97+
98+
```{r}
99+
#| label: diagnostic-tools
100+
#| eval: false
101+
# Check Docker environment
102+
sitrep_docker()
103+
104+
# Analyze app containerization readiness
105+
sitrep_app_conversion("path/to/your/shinyapp")
39106
```
40107

41-
What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so:
42108

43-
```{r cars}
44-
summary(cars)
109+
110+
## Advanced Configuration
111+
112+
### Custom Dockerfile
113+
114+
```{r}
115+
#| label: custom-dockerfile
116+
#| eval: false
117+
# Use a custom Dockerfile template
118+
dockerize("path/to/your/shinyapp",
119+
custom_dockerfile = "path/to/custom/Dockerfile")
45120
```
46121

47-
You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this.
122+
### Environment Variables
48123

49-
You can also embed plots, for example:
124+
```{r}
125+
#| label: dockerize
126+
#| eval: false
127+
# Set environment variables during containerization
128+
dockerize("path/to/your/shinyapp",
129+
env_vars = c(API_KEY = "your-secret-key"))
130+
```
50131

51-
```{r pressure, echo = FALSE}
52-
plot(pressure)
132+
## Cleanup and Management
133+
134+
```{r}
135+
#| label: cleanup-and-management
136+
#| eval: false
137+
# Stop a specific container
138+
stop_containers("path/to/your/shinyapp")
139+
140+
# Clean up Docker containers and images
141+
cleanup_containers(remove_images = TRUE)
53142
```
54143

55-
In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN.
144+
## License
145+
146+
AGPL (>= 3)

README.md

Lines changed: 93 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,121 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33

4-
# shinydocker
4+
> \[!IMPORTANT\]
5+
>
6+
> This package is currently in the prototype/experimental stage. It is
7+
> not yet available on CRAN and may have bugs or limitations.
8+
9+
# shinydocker <img src="man/figures/shinydocker-animated-logo.svg" align="right" height="139" />
510

611
<!-- badges: start -->
712

13+
[![R-CMD-check](https://github.com/coatless-rpkg/shinydocker/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/shinydocker/actions/workflows/R-CMD-check.yaml)
14+
![Prototype](https://img.shields.io/badge/Status-Prototype-orange)
15+
![Experimental](https://img.shields.io/badge/Status-Experimental-blue)
816
<!-- badges: end -->
917

10-
The goal of shinydocker is to …
18+
`shinydocker` is an R package that streamlines the process of
19+
containerizing Shiny applications, supporting both R and Python Shiny
20+
apps.
1121

1222
## Installation
1323

14-
You can install the development version of shinydocker from
15-
[GitHub](https://github.com/) with:
24+
You can install the development version of `shinydocker` from GitHub
25+
with:
1626

1727
``` r
18-
# install.packages("pak")
19-
pak::pak("coatless-rpkg/shinydocker")
28+
# install.packages("remotes")
29+
remotes::install_github("coatless-rpkg/shinydocker")
2030
```
2131

22-
## Example
32+
You will also need to have Docker installed on your system. You can
33+
download Docker from the [official
34+
website](https://www.docker.com/products/docker-desktop). You do not
35+
need to log in to Docker to use `shinydocker`.
36+
37+
## Using shinydocker
38+
39+
The package provides a set of functions to automate the process, as well
40+
as options for advanced configuration.
41+
42+
### Exporting a Shiny App to Docker
43+
44+
The `export()` function allows you to convert a Shiny application into a
45+
docker containerized application.
46+
47+
``` r
48+
# Automated export: configures, builds, and optionally runs the container
49+
export("path/to/your/shinyapp", run = TRUE)
50+
```
2351

24-
This is a basic example which shows you how to solve a common problem:
52+
For example, to convert the “Hello World” Shiny app from the `{shiny}`
53+
package into a standalone Electron app:
54+
55+
``` r
56+
# Copy "Hello World" from `{shiny}`
57+
system.file("examples", "01_hello", package="shiny") |>
58+
fs::dir_copy("myapp", overwrite = TRUE)
59+
60+
shinydocker::export("myapp", run = TRUE)
61+
```
62+
63+
### Manually Dockerizing a Shiny App
2564

2665
``` r
2766
library(shinydocker)
28-
## basic example code
67+
68+
# Path to your Shiny app
69+
shiny_app_path <- "path/to/your/shinyapp"
70+
71+
# Create Docker configuration for a Shiny app
72+
dockerize(shiny_app_path)
73+
74+
# Build a Docker image
75+
build_image(shiny_app_path)
76+
77+
# Run the container
78+
run_container(shiny_app_path)
79+
```
80+
81+
### Diagnostic Tools
82+
83+
``` r
84+
# Check Docker environment
85+
sitrep_docker()
86+
87+
# Analyze app containerization readiness
88+
sitrep_app_conversion("path/to/your/shinyapp")
2989
```
3090

31-
What is special about using `README.Rmd` instead of just `README.md`?
32-
You can include R chunks like so:
91+
## Advanced Configuration
92+
93+
### Custom Dockerfile
3394

3495
``` r
35-
summary(cars)
36-
#> speed dist
37-
#> Min. : 4.0 Min. : 2.00
38-
#> 1st Qu.:12.0 1st Qu.: 26.00
39-
#> Median :15.0 Median : 36.00
40-
#> Mean :15.4 Mean : 42.98
41-
#> 3rd Qu.:19.0 3rd Qu.: 56.00
42-
#> Max. :25.0 Max. :120.00
96+
# Use a custom Dockerfile template
97+
dockerize("path/to/your/shinyapp",
98+
custom_dockerfile = "path/to/custom/Dockerfile")
4399
```
44100

45-
You’ll still need to render `README.Rmd` regularly, to keep `README.md`
46-
up-to-date. `devtools::build_readme()` is handy for this.
101+
### Environment Variables
47102

48-
You can also embed plots, for example:
103+
``` r
104+
# Set environment variables during containerization
105+
dockerize("path/to/your/shinyapp",
106+
env_vars = c(API_KEY = "your-secret-key"))
107+
```
108+
109+
## Cleanup and Management
110+
111+
``` r
112+
# Stop a specific container
113+
stop_containers("path/to/your/shinyapp")
114+
115+
# Clean up Docker containers and images
116+
cleanup_containers(remove_images = TRUE)
117+
```
49118

50-
<img src="man/figures/README-pressure-1.png" width="100%" />
119+
## License
51120

52-
In that case, don’t forget to commit and push the resulting figure
53-
files, so they display on GitHub and CRAN.
121+
AGPL (\>= 3)

0 commit comments

Comments
 (0)