概要
タイトルまんま
ディレクトリ構成
r-shiny-docker
├── apps
│ ├── appdir
│ │ ├── server.R
│ │ └── ui.R
│ └── index.html
└── docker-compose.yml
docker-compose.yml
docker-compose.yml
version: "3"
services:
shiny:
image: rocker/shiny:3.4.4
ports:
- 3838:3838
volumes:
- "./apps:/srv/shiny-server"
server.R
server.R
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
ui.R
ui.R
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
))
index.html
index.html
hello
接続
http://localhost:3838/appdir/で
参考
- (rocker-org/shiny)[https://github.com/rocker-org/shiny]