All Projects → messense → Rust Musl Cross

messense / Rust Musl Cross

Licence: other
Docker images for compiling static Rust binaries using musl-cross

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rust Musl Cross

Docker Workshop
Introduction to Docker tutorial
Stars: ✭ 124 (-13.29%)
Mutual labels:  docker-image
Iobroker.docker
Official Docker Image for ioBroker
Stars: ✭ 133 (-6.99%)
Mutual labels:  docker-image
Caddy Gen
Automated Caddy reverse proxy for docker containers
Stars: ✭ 139 (-2.8%)
Mutual labels:  docker-image
4minitz
4Minitz - Simply a decent free webapp for taking collaborative meeting minutes. (Keywords: Meeting Protocols, Action Items, Open Source). Check it out on our demo server:
Stars: ✭ 125 (-12.59%)
Mutual labels:  docker-image
Laravel Docker K8s
Running Laravel project using Docker and Deploying using Kubernetes
Stars: ✭ 127 (-11.19%)
Mutual labels:  docker-image
Sec Tools
Docker images for infosec tools
Stars: ✭ 135 (-5.59%)
Mutual labels:  docker-image
Prom2teams
prom2teams is an HTTP server built with Python that receives alert notifications from a previously configured Prometheus Alertmanager instance and forwards it to Microsoft Teams using defined connectors
Stars: ✭ 122 (-14.69%)
Mutual labels:  docker-image
Awesome Container Security
Awesome list of resources related to container security
Stars: ✭ 140 (-2.1%)
Mutual labels:  docker-image
Laravel Dusk Ci
Docker Test suite for Laravel Dusk in gitlab CI
Stars: ✭ 129 (-9.79%)
Mutual labels:  docker-image
Mq Container
Container images for IBM® MQ
Stars: ✭ 138 (-3.5%)
Mutual labels:  docker-image
Kubler
A generic, extendable build orchestrator.
Stars: ✭ 126 (-11.89%)
Mutual labels:  docker-image
Mdtopdf
🐳 Pandoc docker image for converting markdown to PDF using TeX typesetting
Stars: ✭ 127 (-11.19%)
Mutual labels:  docker-image
Bhadoo Cloud
Directly Upload to Google Drive from Torrent or URLs
Stars: ✭ 136 (-4.9%)
Mutual labels:  docker-image
Foundryvtt Docker
An easy-to-deploy Dockerized Foundry Virtual Tabletop server.
Stars: ✭ 123 (-13.99%)
Mutual labels:  docker-image
Microsoftmlserver Docker
An unofficial Microsoft Machine Learning Server Docker image.
Stars: ✭ 139 (-2.8%)
Mutual labels:  docker-image
Tun2socks
tun2socks - powered by gVisor TCP/IP stack
Stars: ✭ 123 (-13.99%)
Mutual labels:  docker-image
Docker Matrix
docker image for matrix.org
Stars: ✭ 134 (-6.29%)
Mutual labels:  docker-image
Docker Streaming Server
Live streaming server
Stars: ✭ 141 (-1.4%)
Mutual labels:  docker-image
Docker Magento
Docker image for Magento 1.6 to 1.9
Stars: ✭ 140 (-2.1%)
Mutual labels:  docker-image
Docker Spigot
A docker container with spigot, builds spigot.jar on first start
Stars: ✭ 137 (-4.2%)
Mutual labels:  docker-image

rust-musl-cross

Docker images for compiling static Rust binaries using musl-cross-make, inspired by rust-musl-builder

Docker Image Build

Prebuilt images

Currently we have the following prebuilt Docker images on Docker Hub.

Rust toolchain Cross Compile Target Docker Image Tag
stable aarch64-unknown-linux-musl aarch64-musl
stable arm-unknown-linux-musleabi arm-musleabi
stable arm-unknown-linux-musleabihf arm-musleabihf
stable armv5te-unknown-linux-musleabi armv5te-musleabi
stable armv7-unknown-linux-musleabi armv7-musleabi
stable armv7-unknown-linux-musleabihf armv7-musleabihf
stable i586-unknown-linux-musl i586-musl
stable i686-unknown-linux-musl i686-musl
stable mips-unknown-linux-musl mips-musl
stable mipsel-unknown-linux-musl mipsel-musl
stable x86_64-unknown-linux-musl x86_64-musl

To use armv7-unknown-linux-musleabihf target for example, first pull the image:

docker pull messense/rust-musl-cross:armv7-musleabihf

Then you can do:

alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf'
rust-musl-builder cargo build --release

This command assumes that $(pwd) is readable and writable. It will output binaries in armv7-unknown-linux-musleabihf. At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds.

How it works

rust-musl-cross uses musl-libc, musl-gcc with the help of musl-cross-make to make it easy to compile, and the new rustup target support. It includes static versions of several libraries:

  • The standard musl-libc libraries.
  • OpenSSL, which is needed by many Rust applications.

Making OpenSSL work

If your application uses OpenSSL, you will also need to take a few extra steps to make sure that it can find OpenSSL's list of trusted certificates, which is stored in different locations on different Linux distributions. You can do this using openssl-probe as follows:

extern crate openssl_probe;

fn main() {
    openssl_probe::init_ssl_cert_env_vars();
    //... your code
}

Use beta/nightly Rust

Currently we install stable Rust by default, if you want to switch to beta/nightly Rust, you can do it by extending from our Docker image, for example to use beta Rust for target x86_64-unknown-linux-musl:

FROM messense/rust-musl-cross:x86_64-musl
RUN rustup update beta && \
    rustup target add --toolchain beta x86_64-unknown-linux-musl

Strip binaries

You can use the musl-strip command inside the image to strip binaries, for example:

docker run --rm -it -v "$(pwd)":/home/rust/src messense/rust-musl-cross:armv7-musleabihf musl-strip /home/rust/src/target/release/example

License

Licensed under The MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].