From ec55b2ebf7ffcfebadb08b15dd400bf7c2ae59e4 Mon Sep 17 00:00:00 2001
From: Dominik Brilhaus <brilhaus@nfdi4plants.org>
Date: Tue, 18 Mar 2025 17:19:32 +0100
Subject: [PATCH] try fix docker for shiny

---
 workflows/shiny/Dockerfile   | 13 +++++++++++++
 workflows/shiny/shiny-app.R  |  4 ++--
 workflows/shiny/workflow.cwl |  5 +++--
 3 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 workflows/shiny/Dockerfile

diff --git a/workflows/shiny/Dockerfile b/workflows/shiny/Dockerfile
new file mode 100644
index 0000000..01b85ff
--- /dev/null
+++ b/workflows/shiny/Dockerfile
@@ -0,0 +1,13 @@
+# Use an official R base image
+FROM rocker/shiny:4.4
+
+# Install R packages
+RUN R -q -e 'install.packages("ggplot2")'
+
+EXPOSE 3838
+
+# Set the working directory to /app
+WORKDIR /app
+
+# Default command to run when the container starts
+CMD ["R"]
diff --git a/workflows/shiny/shiny-app.R b/workflows/shiny/shiny-app.R
index 4c02024..4d4275f 100644
--- a/workflows/shiny/shiny-app.R
+++ b/workflows/shiny/shiny-app.R
@@ -3,7 +3,6 @@
 # Load libraries
 
 library(shiny)
-library(RColorBrewer)
 library(ggplot2)
 
 # CLI arguments
@@ -65,4 +64,5 @@ server <- function(input, output, session) {
 
 # Launch app
 
-shinyApp(ui, server)
+sa <- shinyApp(ui, server)
+runApp(sa, port = 3838)
diff --git a/workflows/shiny/workflow.cwl b/workflows/shiny/workflow.cwl
index 2e80423..00d0f26 100644
--- a/workflows/shiny/workflow.cwl
+++ b/workflows/shiny/workflow.cwl
@@ -4,8 +4,9 @@ cwlVersion: v1.2
 class: CommandLineTool
 
 # hints:
-#   DockerRequirement: 
-#     dockerPull: 
+#   DockerRequirement:
+#     dockerImageId: "shiny"
+#     dockerFile: {$include: "Dockerfile"}
 
 requirements:
   - class: InitialWorkDirRequirement
-- 
GitLab