rust/README.md

52 lines
925 B
Markdown
Raw Permalink Normal View History

2024-05-16 18:52:20 +01:00
# docker-builder-rust
2024-05-16 17:59:27 +01:00
2024-05-16 18:52:20 +01:00
Docker image for building Rust projects with Cargo.
## Usage
In a Forgejo action file, e.g. `.forgejo/workflows/test.yml`:
```yml
on: [push]
jobs:
test:
runs-on: docker
steps:
- uses: https://git.kemitix.net/kemitix/rust@v0.3.0
2024-05-16 18:52:20 +01:00
with:
args: test
- uses: https://git.kemitix.net/kemitix/rust@v0.3.0
2024-05-16 18:52:20 +01:00
with:
args: build
```
## Contents
- nodejs
- clang-16
- mold
- rust
- git
2024-05-16 18:52:20 +01:00
- cargo
- cargo-binstall
## Linking
To take advantage of the clang and mold packages, add the following to the `.cargo/config.toml` file in your project.
```toml
2024-05-17 06:56:50 +01:00
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang-16"
2024-05-16 18:52:20 +01:00
rustflags = ["-C", "link-arg=--ld-path=/usr/bin/mold"]
```
## Binary size
To reduce the size of the debug binary, add the following to the `.cargo/config.toml` file in you project.
```toml
2024-05-17 06:56:50 +01:00
[profile.dev]
debug = 0
2024-05-16 18:52:20 +01:00
strip = "debuginfo"
```