Skip to content

paul-hansen/bevy_steamos_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

A Docker image for building Bevy games for SteamOS (SteamDeck).

Building apps for Linux from your development PC and sharing that build with another PC can be inconsistent because Linux uses shared libraries and your PC may have linked newer libraries that are incompatible with the target PC's older libraries. This is especially true with the SteamDeck as it may not have the newest versions (e.g. glibc) and cannot be easily updated until Steam releases their official update.

The solution is to build in an environment with older versions of these libraries that are forwards compatible with the new versions to ensure maximum compatibility. Valve provides containers made for doing this.

This Docker image simply uses Valve's Docker image and adds Rust and the libraries needed for compiling Bevy apps on Linux.

Basic Usage

Build the docker image

docker build -t bevy_steamos https://raw.githubusercontent.com/paul-hansen/bevy_steamos_docker/main/Dockerfile

From your project directory, run:

docker run -v .:/usr/src/project bevy_steamos

By default the container will run cargo build --release on your project directory. You can find the resulting binary file in the ./target/release directory

Advanced Usage

Example Build Script

For a more complete workflow including Steam Devkit integration, see example_script.sh. This script:

  • Automatically builds the Docker image if not present
  • Runs the build
  • Copies the binary and assets to a build directory
  • Notifies the Steam Devkit Client for auto-upload to the SteamDeck

Copy it to your project root and run it to streamline your development workflow.

Custom Build Commands

You can override the default build command. For example, to build a debug build (without --release):

docker run -v .:/usr/src/project bevy_steamos cargo build

Custom Rust Version

By default, the image uses the latest stable Rust version. To specify a different Rust version:

docker build --build-arg RUST_VERSION=1.79.0 -t bevy_steamos https://raw.githubusercontent.com/paul-hansen/bevy_steamos_docker/main/Dockerfile

You can use specific versions (e.g., 1.79.0), or channel names (stable, beta, nightly).

Share Cargo Cache Between Runs

To speed up builds by reusing downloaded crates between runs, mount your local cargo cache:

docker run -v .:/usr/src/project -v ~/.cargo/registry:/usr/local/cargo/registry -v ~/.cargo/git:/usr/local/cargo/git bevy_steamos

This shares your host cargo cache with the container, making subsequent builds much faster.

Pinned Dockerfile Version

To build using a specific version of the Dockerfile, you can use the commit hash in the URL instead of main when building:

docker build -t bevy_steamos https://raw.githubusercontent.com/paul-hansen/bevy_steamos_docker/2f782851ea88509b0406473d600701f007bd8088/Dockerfile

When using in places like CI, this ensures your build process remains consistent even if this repository is updated.

Alternatives

  • cargo-zigbuild: Seems like a cool solution but I haven't tried it yet. Credit to birus on discord for sharing:

    cargo-zigbuild allows you to choose your glibc version. I run cargo zigbuild --release --target x86_64-unknown-linux-gnu.2.27 and it works with steam deck.

About

A Docker image for building Bevy/Rust games for the SteamOS (SteamDeck).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published