You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
869 B

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # rust
  2. Lightweight nightly Rust build including Cargo and GDB
  3. ## Usage
  4. ```sh
  5. $ docker run --rm -it -v $(pwd):/source schickling/rust
  6. ```
  7. Mount your local source folder to the container and compile & run code inside.
  8. #### Compiling code
  9. ```sh
  10. $ rustc hello-world.rs
  11. $ ./hello-world
  12. > Hello World!
  13. ```
  14. #### Environment variables
  15. The `$USER` environment variable can be specified, which is used by `cargo`. The default is `root`.
  16. ```sh
  17. $ docker run --rm -it -e USER="John Doe" -v $(pwd):/source schickling/rust
  18. ```
  19. #### Running cargo as local user
  20. In order to run cargo as a local user and not as root run this:
  21. ```sh
  22. $ docker run --rm -it \
  23. -u $UID \
  24. -e USER=$USER \
  25. -e CARGO_HOME=/source/.cargo \
  26. -v $HOME/.cargo:/source/.cargo \
  27. -v $(pwd):/source \
  28. schickling/rust \
  29. cargo build
  30. ```
  31. Note the new volume for the cargo cache and the `-u` flag.