I’m not an expert on heroku or buildpacks, but (and don’t scream!) I know a thing or two about deploying Rails apps via Dockerfiles. dockerfile-generator is a Rails generator that will inspect your application and generate a dockerfile.
If what you are saying is that you shell out to an R script, that’s beyond what can be automatically detected and I’d need a hint. If you are willing to give it a try, by tomorrow-ish I could have something like the following working for you:
bin/rails generate dockerfile --add r-base
I was planning on adding that support in the next week or so, but I can do that next if you are interested.
I have verified that once r-base-core is added to the Dockerfile, Rscript is available:
% fly ssh console -C Rscript
Connecting to fdaa:0:d445:a7b:ae:56cc:9309:2... complete
Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args]
--options accepted are
--help Print usage and exit
--version Print version and exit
--verbose Print information on progress
--default-packages=list
Where 'list' is a comma-separated set
of package names, or 'NULL'
or options to R, in addition to --no-echo --no-restore, such as
--save Do save workspace at the end of the session
--no-environ Don't read the site and user environment files
--no-site-file Don't read the site-wide Rprofile
--no-init-file Don't read the user R profile
--restore Do restore previously saved objects at startup
--vanilla Combine --no-save, --no-restore, --no-site-file
--no-init-file and --no-environ
'file' may contain spaces but not shell metacharacters
Expressions (one or more '-e <expr>') may be used *instead* of 'file'
See also ?Rscript from within R
You’re a bit of a wizard! I’m not sure how this would be possible, but if I could also define which additional packages to install along with Rscript, that would be helpful. For example, I have to install the “readr” package and all of its dependencies as well.
What I’m suggesting is that you will be able to peruse the following: Debian -- List of sections in "bullseye" and add any of the packages you see there - and as many as you want. If you go to that page and click on “GNU R” you will see a long list of packages. And, yes, any package you select would include the list of dependencies.
Note: I’m not the wizard here. That credit goes to the Debian team.
It is ready to beta test. Functionally complete, docs and tests not yet implemented.
First remove any buildpacks from fly.toml.
Then install/update dockerfile-rails.
if this gem is not in your Gemfile already, run bundle add dockerfile-rails --optimistic --group development
if this gem is already in your Gemfile, run bundle update
Generate a Dockerfile with r-base-core:
bin/rails generate dockerfile --add r-base-core
The generator will remember packages that you have added, so if you want to add another package, run the command again. You can also specify --add multiple times on one command. If you add something you don’t want anymore, run again with --remove.
When ready, fly deploy.
Nothing against buildpacks - they are magic but opaque. Dockerfiles aren’t magic and very transparent/explicit.
Additional information can be found at the FAQ: Dockerfiles and fly.toml · Fly Docs - this page will be updated soon to document how to add and remove packages.