Here's a sketch of the full procedure, including installing additional R packages.
Put your shiny apps in a directory called apps. Multiple apps can live in multiple subdirectories of apps.
Make a file called Dockerfile.base with the following contents.
FROM rocker/shiny
# Install more R packages like this:
RUN . /etc/environment && R -e "install.packages(c('ROCR', 'gbm'), repos='$MRAN')"
Build it locally and push to AWS ECR. Follow AWS's instructions but here's a sketch.
# region="us-west-1"
# aws_account_id=123456789
aws ecr get-login-password --region $region | docker login --username AWS --password-stdin ${aws_account_id}.dkr.ecr.${region}.amazonaws.com
docker build -t rshiny-base Dockerfile.base
docker tag rshiny-base:latest ${aws_account_id}.dkr.ecr.${region}.amazonaws.com/rshiny-base:latest
docker push ${aws_account_id}.dkr.ecr.${region}.amazonaws.com/rshiny-base:latest
Create a new Dockerfile with the following contents. Note that it is copying your apps into the image.
FROM <aws_account_id>.dkr.ecr.<region>.amazonaws.com/rshiny-base
USER shiny
COPY apps /srv/shiny-server
EXPOSE 3838
CMD ["/usr/bin/shiny-server.sh"]
Git-commit, create an Elastic Beanstalk app, and deploy. Here's a sketch:
eb init
eb create shiny
I wrote the full procedure up in a blog post at
https://www.highonscience.com/blog/2021/06/02/shiny-apps-elastic-beanstalk/.