{"id":14067358,"url":"https://github.com/DavidASmith/r-shiny-docker-renv","last_synced_at":"2025-07-30T00:33:22.036Z","repository":{"id":56473037,"uuid":"307955499","full_name":"DavidASmith/r-shiny-docker-renv","owner":"DavidASmith","description":"Example deployment of R Shiny App using Docker and renv","archived":false,"fork":false,"pushed_at":"2020-11-22T16:24:44.000Z","size":14,"stargazers_count":8,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-04T07:37:24.663Z","etag":null,"topics":["azure","docker","r","shiny"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidASmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-28T08:44:34.000Z","updated_at":"2023-10-27T14:43:02.000Z","dependencies_parsed_at":"2022-08-15T19:20:54.286Z","dependency_job_id":null,"html_url":"https://github.com/DavidASmith/r-shiny-docker-renv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DavidASmith/r-shiny-docker-renv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fr-shiny-docker-renv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fr-shiny-docker-renv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fr-shiny-docker-renv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fr-shiny-docker-renv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidASmith","download_url":"https://codeload.github.com/DavidASmith/r-shiny-docker-renv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fr-shiny-docker-renv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267785809,"owners_count":24144122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","docker","r","shiny"],"created_at":"2024-08-13T07:05:33.325Z","updated_at":"2025-07-30T00:33:21.643Z","avatar_url":"https://github.com/DavidASmith.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# Deploying R Shiny Apps with Docker and renv\n\nThis repository is intended as an end-to-end example of deploying an\n[R Shiny](https://shiny.rstudio.com/) application using [Docker](https://www.docker.com/). It also employs\nthe [renv](https://rstudio.github.io/renv/articles/renv.html) R package to simplify package installation in the Docker image.\n\nIt is based on [this blog post](https://www.statworx.com/de/blog/how-to-dockerize-shinyapps/) from [STATWORX](https://www.statworx.com/de/).\n\n## Getting Started\n\nI you don't have it already, install Docker.\n\nThen, move to folder you want to work in and clone this repository.\n\n```\ngit clone https://github.com/DavidASmith/r-shiny-docker-renv.git\n```\n\nExplore the files.\n\n```\ncd r-shiny-docker-renv\nls\n```\nNote that there is a `Dockerfile` which contains all the instructions to build an image of the R Shiny server and our app.\n\nThe `example-app` folder contains the R Shiny app we want to deploy.\n\n## Running the App Locally\n\nTo run the app locally, we must follow these steps:\n\n1. Build the Docker image.\n2. Start the container.\n3. Open the app in the browser.\n\n### Build the Docker Image\n\nTo build the image, navigate to the folder containing the Dockerfile and run the following command.\n\n```\ndocker build -t my-shinyapp-image .\n```\n\n### Start the Container\n\nWait for the build process to finish, then start the container by running the following.\n\n```\ndocker run -d --rm -p 3838:3838 my-shinyapp-image\n```\n\n### Open the App in the Browser\n\nOpen your web browser and go to http://localhost:3838/. The example app 'Old Faithful Geyser Data' is displayed.\n\n## Deploying to Microsoft Azure as a Web App\n\nAssuming you have already...\n\n- Got an Azure project you can work in.\n- Have created a resource group for the app.\n\nWe can deploy the dockerised app to Azure as a Webapp by performing the following steps:\n\n1. Create a container registry to store the image of our app.\n2. Build the image in the container registry.\n3. Deploy the image as a web app.\n\n### Create the Container Registry\n\nUse the following command to create a container registry to store the image of the app.\n\n```\naz acr create --name myregistry --resource-group mygroup --sku standard --admin-enabled true\n```\nWhere:\n\n- `myregistry` is what you want to name your container registry.\n- `mygroup` is the name of the resource group in which the registry will be created.\n\n### Build the Image\n\nNext we need to build the image in the container registry. Run this from the folder which contains the Dockerfile.\n\n```\naz acr build --file Dockerfile --registry myregistry --image myimage .\n```\nWhere:\n\n- `myregistry` is the name of your container registry.\n- `myimage` is what you want to name the image in the registry.\n\n### Deploy the Web App\n\nTo deploy the image as a Web App:\n\n1. In the [Azure portal](https://portal.azure.com/), navigate to the resource group you have been using in the steps above.\n2. Click **+ Add** and select **Web App**. The Create Web App page is displayed.\n3. Enter a **Name** for your app. Note that this will form part of the URL on which the app can be accessed.\n4. Select **Docker Container** as the **Publish** option.\n5. Select **Linux** as the **Operating System**.\n6. Select the **Region** where your app will be hosted.\n7. Select an **App Service Plan** (or leave as default for this example).\n8. Click **Next : Docker \u003e**.\n9. For the **Image Source**, select **Azure Container Registry**.\n10. Select the **Registry** you created in the steps above.\n11. Select the **Image** you created.\n12. Click **Review + create**.\n\nAfter some time for deployment, you should be able to navigate to the newly created App Service in the portal. On the Overview page there is a URL. Go to this URL to view your app.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavidASmith%2Fr-shiny-docker-renv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDavidASmith%2Fr-shiny-docker-renv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavidASmith%2Fr-shiny-docker-renv/lists"}