Skip to content

Commit 26bab82

Browse files
committed
Skeleton
1 parent 133785d commit 26bab82

File tree

9 files changed

+169
-103
lines changed

9 files changed

+169
-103
lines changed

.Rbuildignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^\.devcontainer$
4+
^\.github$
5+
^LICENSE\.md$
6+
^README\.Rmd$

.github/.devcontainer/devcontainer.json

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

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata
5+
.DS_Store

DESCRIPTION

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Package: shinydocker
2+
Title: Containerize Shiny Applications with Docker
3+
Version: 0.1.0
4+
Authors@R: c(
5+
person("James Joseph", "Balamuta",
6+
email = "[email protected]",
7+
role = c("aut", "cre"),
8+
comment = c(ORCID = "0000-0003-2826-8458")
9+
)
10+
)
11+
Description: Provides tools to export Shiny applications (R or Python) into
12+
Docker containers. This package generates appropriate Docker configuration,
13+
builds the container, and provides utilities to run the containerized application.
14+
License: MIT + file LICENSE
15+
Encoding: UTF-8
16+
Roxygen: list(markdown = TRUE)
17+
RoxygenNote: 7.3.2
18+
Imports:
19+
yaml,
20+
processx,
21+
fs,
22+
glue,
23+
cli
24+
Suggests:
25+
testthat (>= 3.0.0)
26+
Config/testthat/edition: 3

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2025
2+
COPYRIGHT HOLDER: shinydocker authors

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 shinydocker authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.Rmd

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
output: github_document
3+
---
4+
5+
<!-- README.md is generated from README.Rmd. Please edit that file -->
6+
7+
```{r, include = FALSE}
8+
knitr::opts_chunk$set(
9+
collapse = TRUE,
10+
comment = "#>",
11+
fig.path = "man/figures/README-",
12+
out.width = "100%"
13+
)
14+
```
15+
16+
# shinydocker
17+
18+
<!-- badges: start -->
19+
<!-- badges: end -->
20+
21+
The goal of shinydocker is to ...
22+
23+
## Installation
24+
25+
You can install the development version of shinydocker from [GitHub](https://github.com/) with:
26+
27+
``` r
28+
# install.packages("pak")
29+
pak::pak("coatless-rpkg/shinydocker")
30+
```
31+
32+
## Example
33+
34+
This is a basic example which shows you how to solve a common problem:
35+
36+
```{r example}
37+
library(shinydocker)
38+
## basic example code
39+
```
40+
41+
What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so:
42+
43+
```{r cars}
44+
summary(cars)
45+
```
46+
47+
You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this.
48+
49+
You can also embed plots, for example:
50+
51+
```{r pressure, echo = FALSE}
52+
plot(pressure)
53+
```
54+
55+
In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN.

README.md

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,53 @@
1-
# r-pkg
21

3-
This repository houses a devcontainer that setups an R package development environment. The container is setup to work with [GitHub Codespaces](https://github.com/features/codespaces) to instantly have a cloud-based developer workflow.
2+
<!-- README.md is generated from README.Rmd. Please edit that file -->
43

5-
You can try out the Codespace by clicking on the following button:
4+
# shinydocker
65

7-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/coatless-devcontainer/r-pkg?quickstart=1)
6+
<!-- badges: start -->
87

9-
> [!NOTE]
10-
>
11-
> Codespaces are available to Students and Teachers for free [up to 180 core hours per month](https://docs.github.com/en/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom#about-github-codespaces)
12-
> through [GitHub Education](https://education.github.com/). Otherwise, you will have
13-
> [up to 60 core hours and 15 GB free per month](https://github.com/features/codespaces#pricing).
8+
<!-- badges: end -->
149

15-
Or, you can press the template button to create a new repository with the same setup so that you
16-
can work locally on the devcontainer:
10+
The goal of shinydocker is to …
1711

18-
[![Use this template](https://img.shields.io/badge/Use%20this%20template-Create%20new%20repository-blue?logo=github)](https://github.com/coatless-devcontainer/r-pkg/generate)
12+
## Installation
1913

20-
This will create a fork of the repository that can be worked on inside a local copy of
21-
[Visual Studio Code](https://code.visualstudio.com/) through the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). With the extension installed, you can open the repository in a container by pressing `F1` (to bring up command palette) and typing `Dev Container: Reopen in Container`.
14+
You can install the development version of shinydocker from
15+
[GitHub](https://github.com/) with:
2216

23-
Lastly, you can directly obtain the underlying container image by typing in Terminal:
24-
25-
```sh
26-
docker pull ghcr.io/coatless-devcontainer/r-pkg:latest
17+
``` r
18+
# install.packages("pak")
19+
pak::pak("coatless-rpkg/shinydocker")
2720
```
2821

29-
## Quick start
22+
## Example
3023

31-
Run the following series of commands inside of R once the container opens. Make sure to change `"name-of-package"` to your current package name.
24+
This is a basic example which shows you how to solve a common problem:
3225

33-
```r
34-
usethis::create_package("name-of-package")
35-
usethis::use_package_doc()
36-
usethis::use_agpl3_license()
37-
usethis::use_testthat()
38-
usethis::use_github_action("check-standard")
39-
usethis::use_pkgdown_github_pages()
26+
``` r
27+
library(shinydocker)
28+
## basic example code
4029
```
4130

42-
## Resources
43-
44-
- [Manual: Writing R extensions](https://cran.r-project.org/doc/manuals/r-release/R-exts.html)
45-
- [Textbook: R Packages](https://r-pkgs.org/)
46-
- [usethis](https://usethis.r-lib.org/)
47-
- [devtools](https://devtools.r-lib.org/)
31+
What is special about using `README.Rmd` instead of just `README.md`?
32+
You can include R chunks like so:
33+
34+
``` 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
43+
```
4844

49-
## Developer notes
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.
5047

51-
This repository uses a pre-built container strategy to have GitHub Actions build and, then, store the devcontainer in [GitHub's Container Repository](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
48+
You can also embed plots, for example:
5249

53-
We place the main logic of the devcontainer in [`.github/.devcontainer/devcontainer.json`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.github/.devcontainer/devcontainer.json). From there, we use [`.github/workflows/pre-build-devcontainer.yml`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.github/workflows/pre-build-devcontainer.yml) to build and publish the devcontainer onto GitHub's Container repository for the organization. Then, the repository's [`.devcontainer/devcontainer.json`](https://github.com/coatless-devcontainer/r-pkg/blob/main/.devcontainer/devcontainer.json) pulls the pre-built image.
50+
<img src="man/figures/README-pressure-1.png" width="100%" />
5451

55-
> [!IMPORTANT]
56-
>
57-
> Make sure to specify the permissions as stated in the GitHub Actions workflow linked above
58-
> and for organizations please make sure to have the organization's container registry enabled.
59-
>
60-
> For more information, see [GitHub's Container Registry documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
52+
In that case, don’t forget to commit and push the resulting figure
53+
files, so they display on GitHub and CRAN.

shinydocker.Rproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Version: 1.0
2+
ProjectId: ae08b067-0a62-43fc-a628-454dcf14140f
3+
4+
RestoreWorkspace: Default
5+
SaveWorkspace: Default
6+
AlwaysSaveHistory: Default
7+
8+
EnableCodeIndexing: Yes
9+
UseSpacesForTab: Yes
10+
NumSpacesForTab: 2
11+
Encoding: UTF-8
12+
13+
RnwWeave: Sweave
14+
LaTeX: pdfLaTeX
15+
16+
BuildType: Package
17+
PackageUseDevtools: Yes
18+
PackageInstallArgs: --no-multiarch --with-keep.source
19+
PackageRoxygenize: rd,collate,namespace

0 commit comments

Comments
 (0)