Skip to content

Commit 58ec3fe

Browse files
committed
Always use a temporary file and, then, cast to a temporary directory.
1 parent 0bc3b06 commit 58ec3fe

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

inst/demo-py-shiny-containerization.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Create a simple Shiny for Python app
2-
app_dir <- tempdir()
2+
app_dir <- tempfile()
3+
dir.create(app_dir)
34
writeLines(
45
'from shiny import App, ui, render
56
import numpy as np
@@ -29,7 +30,7 @@ file.path(app_dir, "app.py")
2930
)
3031

3132
# Export the app
32-
shinydocker::export(app_dir, run = TRUE, detached = TRUE)
33+
shinydocker::export(app_dir, run = TRUE, detach = TRUE)
3334

3435
# Stop the container
3536
stop_container(app_dir)
@@ -43,4 +44,4 @@ shinydocker::run_container(app_dir, detach = TRUE)
4344
# Build Docker image
4445
# shinydocker::build_image(app_dir)
4546
# Run the containerized app
46-
# shinydocker::run_container(app_dir, detached = TRUE)
47+
# shinydocker::run_container(app_dir, detach = TRUE)

inst/demo-r-shiny-containerization.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Create a simple Shiny app
2-
app_dir <- tempdir()
1+
# Create a simple R Shiny app
2+
app_dir <- tempfile()
3+
dir.create(app_dir)
34
writeLines(
45
'library(shiny)
56
@@ -27,7 +28,7 @@ writeLines(
2728
)
2829

2930
# Export the app
30-
shinydocker::export(app_dir, run = TRUE, detached = TRUE)
31+
shinydocker::export(app_dir, run = TRUE, detach = TRUE)
3132

3233
## Alternatively, steps can be run separately ----
3334

0 commit comments

Comments
 (0)