Skip to content
Snippets Groups Projects
Commit 392d247f authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

import example project from https://gitlab.pasteur.fr/hub/rshiny-k8s

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #102367 failed
image: registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:latest
services:
- registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
build-example:
stage: build
needs: ["build"]
only:
- main
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
# pull the latest example of rshiny-k8s image
- docker pull "$CI_REGISTRY_IMAGE/example:latest" || true
# build the image while passing commit SHA and versions, and tagging the image with them
- docker build
--cache-from "$CI_REGISTRY_IMAGE/example:latest"
--tag "$CI_REGISTRY_IMAGE/example:latest"
--tag "$CI_REGISTRY_IMAGE/example:$CI_COMMIT_SHORT_SHA"
-f example.Dockerfile
./
# push image tagged as example
- docker push "$CI_REGISTRY_IMAGE/example:latest"
# push image tagged as example with its commit sha (debug purpose)
- docker push "$CI_REGISTRY_IMAGE/example:$CI_COMMIT_SHORT_SHA"
# FROM registry-gitlab.pasteur.fr/hub/rshiny-k8s:4.2.3--1.5.21.1006
# FROM registry-gitlab.pasteur.fr/hub/rshiny-k8s:1.5.21.1006
# FROM registry-gitlab.pasteur.fr/hub/rshiny-k8s:4.2.3
FROM registry-gitlab.pasteur.fr/hub/rshiny-k8s:latest
# Copy your dependencies, destination filename must be "packages_to_install.csv"
COPY ./example_proj/my_packages_to_install.csv /opt/scripts/packages_to_install.csv
# Install R packages
RUN Rscript /opt/scripts/install_r_packages.R
# Copy you shiny app
COPY ./example_proj /srv/shiny-server
# rshiny-k8s-example
## Aim of the project
Provide an example on how to use [hub/rshiny-k8s](https://gitlab.pasteur.fr/hub/rshiny-k8s) docker image and helm recipe to deploy a RShiny app on kubernetes
## How to re-use
TODO
\ No newline at end of file
app.R 0 → 100644
# Name : app.R
# Folder : ~/rshiny-k8s/example_proj
# Date : 05/04/23
# Aim : Simple example of app developped in RShiny.
# Authors : From Shiny Examples - Modify by Elodie C. et Bryan B.
# Load packages -------------------------------------------------------------------
library(shiny)
# Optional librairies - only for test.
# Cran and bioconductor librairies
library(shinythemes)
library(biomaRt)
# UI part -------------------------------------------------------------------------
# Define UI for app that draws a histogram ----
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny in docker image!"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Slider for the number of bins ----
sliderInput(inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Histogram ----
plotOutput(outputId = "distPlot")
)
)
)
# Server part -------------------------------------------------------------------------
# Define server logic required to draw a histogram ----
server <- function(input, output) {
# Histogram of the Old Faithful Geyser Data ----
# with requested number of bins
# This expression that generates a histogram is wrapped in a call
# to renderPlot to indicate that:
#
# 1. It is "reactive" and therefore should be automatically
# re-executed when inputs (input$bins) change
# 2. Its output type is a plot
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")
})
}
# Run Shiny app ----------------------------------------------------------------------
shinyApp(ui = ui, server = server)
shiny
shinythemes
biomaRt
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment