Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

VincentGuyader/shiny2docker

Repository files navigation

Lifecycle: stableR-CMD-checkCRAN status

shiny2docker is an R package designed to streamline the process ofcontainerizing Shiny applications using Docker. By automating thegeneration of essential Docker files and managing R dependencies withrenv,shiny2docker simplifies the deployment of Shiny apps, ensuringreproducibility and consistency across different environments.

Features

  • Automated Dockerfile Generation:
    Quickly generate Dockerfiles tailored for Shiny applications. The mainfunction,shiny2docker(), creates a Dockerfile using arenv.lockfile to capture your R package dependencies.

  • Dependency Management:
    Utilizerenv to manage and restore R package dependencies. If alockfile does not exist,shiny2docker() will automatically createone for production using theattachment::create_renv_for_prodfunction.

  • Customizability:
    Theshiny2docker() function returns adockerfiler object thatcan be further manipulated usingdockerfiler’s methods beforewriting it to a file. This enables advanced users to customize theDockerfile to better suit their needs. Seedockerfiler for moredetails.

  • GitLab CI Integration:
    With theset_gitlab_ci() function, you can easily configure yourGitLab CI pipeline. This function copies a pre-configuredgitlab-ci.yml file from the package into your project directory. Theprovided CI configuration is designed to build your Docker image andpush the created image to the GitLab container registry, therebystreamlining continuous integration and deployment workflows.

  • GitHub Actions Integration:
    With theset_github_action() function, you can quickly set up aGitHub Actions pipeline. This function copies a pre-configureddocker-build.yml file from the package into the.github/workflows/directory of your project. The provided CI configuration is designedto build your Docker image and push the created image to the GitHubContainer Registry, facilitating automated builds and deployments onGitHub.

Installation

You can install the production version from CRAN with :

install.packages("shiny2docker")

You can install the development version ofshiny2docker fromGitHub with:

# install.packages("pak")pak::pak("VincentGuyader/shiny2docker")

Usage

Generate a Dockerfile for a Shiny Application

Use theshiny2docker() function to automatically generate a Dockerfilebased on your application’s dependencies.

library(shiny2docker)# Generate Dockerfile in the current directoryshiny2docker(path=".")# Generate Dockerfile with a specific renv.lock and output pathshiny2docker(path="path/to/shiny/app",lockfile="path/to/shiny/app/renv.lock",output="path/to/shiny/app/Dockerfile")# Further manipulate the Dockerfile object before writing to diskdocker_obj<- shiny2docker()docker_obj$ENV("MY_ENV_VAR","value")docker_obj$write("Dockerfile")

Configure GitLab CI for Docker Builds

Theset_gitlab_ci() function allows you to quickly set up a GitLab CIpipeline that will build your Docker image and push it to the GitLabcontainer registry.

library(shiny2docker)# Copy the .gitlab-ci.yml file to the current directoryset_gitlab_ci()# Specify runner tagsset_gitlab_ci(tags= c("shiny_build","prod"))

Configure GitHub Actions for Docker Builds

The newset_github_action() function allows you to quickly set up aGitHub Actions pipeline that will build your Docker image and push it tothe GitHub Container Registry.

library(shiny2docker)# Copy the docker-build.yml file to the .github/workflows/ directoryset_github_action(path=".")

Once thedocker-build.yml file is in place, you can integrate it withGitHub Actions to automate the Docker image build and deploymentprocess.

Example Workflow

  1. Prepare Your Shiny Application:
    Ensure that your Shiny app is located in a folder with the necessaryfiles (e.g.,app.R orui.R andserver.R).

  2. Generate the Dockerfile:
    Runshiny2docker() to create the Dockerfile (and a.dockerignorefile) in your project directory. This Dockerfile will includeinstructions to install system dependencies, R packages, and launchthe Shiny app.

  3. Set Up Continuous Integration (Optional):

    • If you use GitLab, runset_gitlab_ci() to copy thepre-configured GitLab CI file into your project. This CIconfiguration will handle the Docker image build and deployment toGitLab’s container registry.
    • If you use GitHub, runset_github_action(path = ".") to copy thepre-configured GitHub Actions file into your project. This CIconfiguration will build your Docker image and push it to theGitHub Container Registry.
  4. Deploy Your Application:
    Use Docker to build and run your image, or integrate with yourchosen CI/CD service for automated deployments.

License

This project is licensed under the terms of the MIT license.

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp