| 1 | ARG RUST_VERSION=1.88 |
| 2 | FROM rust:${RUST_VERSION}-slim-bookworm |
| 3 | |
| 4 | # Native DBus headers and pkg-config are required by libdbus-sys during |
| 5 | # `cargo build`. Keep these development dependencies in the Dev Container, |
| 6 | # rather than adding them to the production runtime image. |
| 7 | RUN apt-get update \ |
| 8 | && apt-get install -y --no-install-recommends \ |
| 9 | ca-certificates \ |
| 10 | git \ |
| 11 | libdbus-1-dev \ |
| 12 | pkg-config \ |
| 13 | && rm -rf /var/lib/apt/lists/* |
| 14 | |
| 15 | # The official Rust image keeps its toolchain here. Preserve it after switching |
| 16 | # from the image's root user to the non-root development user below. |
| 17 | ENV PATH=/usr/local/cargo/bin:${PATH} |
| 18 | RUN printf '%s\n' 'export PATH=/usr/local/cargo/bin:$PATH' \ |
| 19 | > /etc/profile.d/codewhale-rust.sh |
| 20 | RUN rustup component add rustfmt |
| 21 | |
| 22 | RUN groupadd --gid 1000 codewhale \ |
| 23 | && useradd --create-home --shell /bin/bash --uid 1000 --gid 1000 codewhale \ |
| 24 | && install -d -m 0700 -o codewhale -g codewhale /home/codewhale/.codewhale \ |
| 25 | && install -d -m 0755 -o codewhale -g codewhale /home/codewhale/.cargo \ |
| 26 | && install -d -m 0755 -o codewhale -g codewhale /home/codewhale/.cargo/target |
| 27 | |
| 28 | USER codewhale |
| 29 | WORKDIR /workspaces/CodeWhale |
| 30 |