repo: github.com/andrewbtran/docker_sample_project
slides: andrewbtran.github.io/docker_sample_project/presentation/docker_and_r.html
You can host:
Make your own code acadamy type of courses.
Spend a few dollars to spin up a server with 32 cores and 192 GB of ram for a few hours for complex data analysis.
Washington Post Python data munging + R modeling + Plumber API = Live election predictions
Washington Post Python data munging + R modeling + Plumber API = Live election predictions
Digital Ocean
AWS (or whatever your news org uses)
More specific instructions here
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
$ sudo apt update
$ sudo apt install r-base
More specific instructions here
Create/Organize your folders through the command line
Copy a local file to your server:
$ scp depends.R remote_username@10.10.0.2:/remote/directory
$ Rscript depends.R
Shiny server
Rstudio cloud
Brewing and drinking beer
FROM rocker/shiny
$ docker build -t docker_sample_project .
Last line in my dockerfile:
EXPOSE 3838
In the command line:
docker-compose down && docker-compose rm && docker-compose up --force-recreate --build
You can quickly figure out the local hosting address through your Docker Desktop App.
Upload repo to Github
Let it start building.
Or follow the instructions on whatever hosting platform (Heroku, AWS, Cloud Run) you use to install Docker.
$ ssh root@xxx.xx.xxx.x
Make sure the R server processes are running after ending ssh session
$ tmux
$ docker run --rm -p 80:3838 abtran/docker_sample_project:latest
Carefully exit the server.
Leave/detach the tmux session by typing Ctrl+b and then d
Visit your page online (in your hosting you can point it a domain name, etc).
If you want to update later, ssh into your server and type
$ tmux attach
$ docker run --rm -p 80:3838 abtran/docker_sample_project:latest
Leave/detach the tmux concurrent session by typing Ctrl+b and then d