|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +# Toolchain is pinned by rust-toolchain.toml (channel 1.96.0). The base |
| 19 | +# image ships rustup, so the pin auto-resolves on first cargo invocation. |
| 20 | +ARG RUST_VERSION=1.96 |
| 21 | +FROM rust:${RUST_VERSION}-slim-trixie |
| 22 | + |
| 23 | +# Build + runtime dependencies mirror the production Dockerfile builder |
| 24 | +# stage (native TLS, hwloc topology, udev) plus the Node.js toolchain the |
| 25 | +# web UI build requires. git/curl/sudo/pkg-config round out the dev shell. |
| 26 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 27 | + build-essential \ |
| 28 | + ca-certificates \ |
| 29 | + curl \ |
| 30 | + git \ |
| 31 | + pkg-config \ |
| 32 | + libssl-dev \ |
| 33 | + libhwloc-dev \ |
| 34 | + libudev-dev \ |
| 35 | + liblzma5 \ |
| 36 | + nodejs \ |
| 37 | + npm \ |
| 38 | + sudo \ |
| 39 | + && rm -rf /var/lib/apt/lists/* |
| 40 | + |
| 41 | +# Pre-fetch the pinned toolchain components (rustfmt, clippy) so the first |
| 42 | +# in-container build does not stall resolving them. rust-src is added for |
| 43 | +# rust-analyzer sysroot / standard-library resolution. |
| 44 | +COPY rust-toolchain.toml /tmp/rust-toolchain.toml |
| 45 | +RUN cd /tmp && rustup show && rustup component add rust-src && rm rust-toolchain.toml |
| 46 | + |
| 47 | +# Create a non-root user matching the default VS Code devcontainer UID/GID |
| 48 | +# so bind-mounted workspace files keep sane ownership. |
| 49 | +ARG USERNAME=vscode |
| 50 | +ARG USER_UID=1000 |
| 51 | +ARG USER_GID=${USER_UID} |
| 52 | +RUN groupadd --gid ${USER_GID} ${USERNAME} \ |
| 53 | + && useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \ |
| 54 | + && echo "${USERNAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \ |
| 55 | + && chmod 0440 /etc/sudoers.d/${USERNAME} |
| 56 | + |
| 57 | +USER ${USERNAME} |
0 commit comments