diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..091812df29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM debian:bookworm-slim AS build + +RUN apt-get update && apt-get install -y \ + curl ca-certificates build-essential pkg-config \ + libssl-dev clang \ + && rm -rf /var/lib/apt/lists/* + +# Install rustup +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal +ENV PATH="/root/.cargo/bin:${PATH}" + +WORKDIR /app +COPY . . + +ENV CC=gcc +ENV Cxx=g++ +ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig + +RUN cargo fetch + +CMD ["/bin/bash"] diff --git a/docs/src/building-rust-gpu.md b/docs/src/building-rust-gpu.md index 0900a102d8..bba7008b27 100644 --- a/docs/src/building-rust-gpu.md +++ b/docs/src/building-rust-gpu.md @@ -39,6 +39,24 @@ cargo run \ You should see `warning: use-installed-tools feature on, skipping compilation of C++ code` during the compilation, but otherwise the build will function just the same as if you compiled the C++ code, with the exception that it will fail if you don't have SPIRV-Tools installed correctly. +## Docker Image + +The repo root contains a Dockerfile that builds rust-gpu and also provides the configured development environment. + +To build it, clone the repository and run the following in the root of the repository. + +```shell +docker build -t rust-gpu-dev . +``` + +To access the container: +```shell +docker run -it --name rust-gpu-dev rust-gpu-dev bash +``` + +The container builds from the current source directory. If you make local changes, and then rebuild those changes will be reflected in the new container image. + + [spirv-builder]: https://rust-gpu.github.io/rust-gpu/api/spirv_builder/index.html [examples]: https://github.com/rust-gpu/rust-gpu/tree/main/examples [examples/runners]: https://github.com/rust-gpu/rust-gpu/tree/main/examples/runners