Skip to content

Building with Docker

Gary edited this page Apr 29, 2020 · 5 revisions

RStudio can build natively on an appropriately configured machine. However, official releases are now (or soon will be) built inside Docker containers. It's occasionally useful to be able to simulate this process using your local machine; for instance:

  • To build a platform for which you don't have a warm development configuration

  • To validate a change which only affects a platform other than your system's native operating system; for instance, an #ifdef that affects Linux when you're developing on macOS

  • To produce one-off release builds for use by QA, customers, etc. without the requirement to set up an entire development machine configured for the target platform

  • To validate the effect of non-code configuration changes

  • To double-check a fix for a build break prior to committing it

etc., etc.

In the build lab, the Docker containers are orchestrated by Jenkins, but on your own development machine, you can kick off builds manually. Inside the docker folder you'll find a script docker-compile.sh. Run it as follows:

./docker-compile.sh IMAGE-NAME FLAVOR-NAME 

where IMAGE-NAME is the image you want to build (run docker-compile.sh with no arguments to get a list of valid images), and FLAVOR-NAME is the product you want to build (e.g. desktop or server). You can also optionally add a version to produce a build with a version label. So, for instance:

 ./docker-compile xenial-amd64 server 1.2.345

would produce an RStudio Server .deb installer from the Ubuntu Xenial container, and label it version 1.2.345.

This script has no prerequisites and takes care of all the Docker minutiae for you; it will build an image from the appropriate Dockerfile, configure RStudio, and compile it inside a container.

Debug builds

By default, docker-compile will produce a release build. If you want to produce a debug build, set the CMAKE_BUILD_TYPE environment variable to Debug prior to building. For example:

CMAKE_BUILD_TYPE=Debug ./docker-compile fedora28-x86_64 desktop 1.2.345

Windows Specifics

To build the Windows installer via Docker, you need:

  • Windows-10 Pro 64-bit or better
  • Hyper-V enabled
  • Docker for Windows, with Windows containers
  • use win-docker-compile.cmd from command-prompt, with no arguments to start the build