This is the FASTGenomics base image for R Shiny analyses. Clone this repository if you want to bring your own Shiny App to FASTGenomics. You can find an example Shiny analyses on FASTGenomics, and a basic Shiny tutorial here.
See also our FASTGenomics documentation on Working with Custom Docker Images.
APP
All your shiny app code and runtime data has to go here. At least anapp.R
file has to be present.fg_config
Don't modify this directory
The files in this directory are required to correctly integrate your app into FASTGenomics.
Dockerfile
The instructions on how to build your docker container. You do not need to modify it, unless you want to- Use another base image
- Install additional system packages
- Copy additional data for the use during image building
install.R
ThisR
file is executed during image build. Usually it is used to installR
packages.
-
Prerequisites. You need to have Docker Desktop installed on your computer as well as an user account at Docker.
-
Clone this repository.
-
Add your code and data. All your code and data goes to the
APP
directory. The whole folder and it's contents are available at runtime. It is mandatory that there is at least anapp.R
file which will get executed at container runtime (replace the existing one). -
Install additional packages. If your app requires additional packages there are usually two places to install them:
Dockerfile
Add system libraries or packages viaapt-get install
. Just append the existing list.
You can also select another base image by changing theFROM
at the top of theDockerfile
. However, therocker/shiny-verse
is usually a good start as it contains shiny and alltidy-verse
packages. Currently, we use it withR
version 4.install.R
In this file you add all your code to install requiredR
packages. Common commands to use areinstall.packages()
ordevtools::install_github()
. The script will be executed during the build of the Docker image.
-
Build your docker image. To build your Docker image just run the following command in the root directory of this repository:
docker build -t <IMAGE_NAME> .
<IMAGE_NAME>
should be in the form<DOCKER_HUB_USERNAME>/<APP_NAME>:<TAG>
. So if you want to build your appfancy_shiny
as userfastgenomics
for the first time, your tag could be version1.0
. Then, the command would be:docker build -t fastgenomics/fancy_shiny:1.0 .
-
Test your docker image locally. Once your image is build, you should test it locally. To start it just run:
docker run -p 3838:3838 <IMAGE_NAME>
The first port number after
-p
flag defines the port on your host machine. You can change it to something else, just make sure to use it when starting the app. The second port number is the default internal port of the shiny app and is set to3838
. This must be the case for use in FASTGenomics.To see your app in action head over to your browser and type
http://localhost:3838/proxy/shiny
If anything goes wrong you can access the logs from within the docker container in the folder
/var/log/shiny-server
. -
Push your image to Docker Hub. The final step is to push your image to Docker Hub by using:
docker push <IMAGE_NAME>
In our example this would be:
docker push fastgenomics/fancy_shiny:1.0
Please note that depending on your internet connection and the image size this can take a while. Alternatively, after testing you can also use automated builds on Docker Hub directly.
-
Create an analysis using your new image on FASTGenomics. To use your new Shiny app in FASTGenomics, create a new analysis with your own image as described here.
- Try to keep the Images size as small as possible.
In the free-to-use version of FASTGenomics, the images has top be pulled from Docker Hub every time it is started.
The bigger your image, the longer it takes.
So if you modify the
Dockerfile
always try to clean temporary files in each layer. - FASTGenomics can only use images that are publicly available on Docker Hub. If you need a more private solution, please contact us via e-mail or Slack
- If you need help with Docker, a good start are the official docker docs.
- You are responsible for the content of your custom images.