Is it possible to get fast Rust compiles in a Docker container?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • cargo-chef

    A cargo-subcommand to speed up Rust Docker builds using Docker layer caching.

  • I did a talk (slides here) about this a few years ago, it took a bit of work to get the build caching working with cargo. As others have pointed out, there is now cargo chef to solve this problem so you probably don't have to deal with the issues I saw, but I thought it still might be helpful context.

  • dagger

    Application Delivery as Code that Runs Anywhere (by dagger)

  • Eventually, I think things like Dagger ( https://dagger.io/ ) / tools with programmable build stages will mature and be a bit more usable in the long run than scripting around Docker-like container engines. I guess plenty of build systems like bazel already exist, but they each seem to suck in their own special ways.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • sccache

    Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.

  • There's also sccache with docker layer caching, which writes back directly to the docker cache through some magic. https://github.com/mozilla/sccache/issues/687

  • for-mac

    Bug reports for Docker Desktop for Mac

  • It seems to be a known problem: https://github.com/docker/for-mac/issues/3677 where people specifically mention hot reloading applications taking forever. Not sure exactly what is going on, but it is not Rust specific (devs mention Ruby, Java, etc.)

  • roadmap

    Welcome to the Public Roadmap for All Things Docker! We welcome your ideas. (by docker)

  • nix

    Nix, the purely functional package manager

  • I'm running into the same issues with Docker. One solution I've seen too is to utilize Nix for the build and have it create the docker image for you as well after building the binary outside of it. That's my rudimentary understanding of the flow anyway, note: just starting to learn Nix

  • sql-udf

    A wrapper for writing MariaDB/MySQL user defined functions in Rust

  • I see you answered a good part of your question, but I might have the dockerfile you want if size/cache is still a concern: https://github.com/pluots/sql-udf/blob/273eaed142f222b75f72d28911613ff5c0740365/Dockerfile.examples

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • multirun

    Run multiple commands and multiplex the standard output (by nicoburns)

  • crustde_cnt_img_pod

    CRUSTDE - Containerized Rust development environment - Hack Without Fear and Trust! (2024-03)

  • grapple_tournament_bot

    A simple bot for the Grapple Tournament discord

  • one of my dockerfiles (includes some SQLX stuff you can ignore) https://github.com/laundmo/grapple_tournament_bot/blob/f5bfb289193740ed697959f8262ba33ecc110fa2/Dockerfile

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts