Skip to content

Commit eb3686b

Browse files
authored
fix: optimize devcontainer build config (#65)
* fix: optimize devcontainer build config * fix: ensure cargo directory permissions in CI
1 parent 92dedb9 commit eb3686b

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@ USER vscode
2323

2424
# Set CARGO_HOME to a location in user home to avoid permission issues in CI
2525
# and add it to PATH
26-
ENV CARGO_HOME=/home/vscode/.cargo
26+
# ENV CARGO_HOME=/home/vscode/.cargo (Deferred until runtime)
2727
ENV PATH=$CARGO_HOME/bin:$PATH
2828
# Set CARGO_TARGET_DIR to a location in user home that is safe from volume mounts
2929
ENV CARGO_TARGET_DIR=/home/vscode/.cargo-target
3030

31-
# Pre-build dependencies to cache them in the image (as vscode)
32-
RUN mkdir -p /tmp/build/src /tmp/build/benches
33-
WORKDIR /tmp/build
34-
COPY Cargo.toml Cargo.lock ./
35-
RUN echo "fn main() {}" > src/main.rs \
36-
&& echo "fn main() {}" > benches/performance.rs \
37-
&& cargo build --release \
38-
&& cargo build \
39-
&& cd / && rm -rf /tmp/build
31+
# No pre-build (cache is disabled by user request)
4032

4133
# Install cargo-binstall as vscode
4234
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

.devcontainer/post-create.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22
set -e
33

4+
# Fix permissions for CI environment where volume mounts may be root-owned
5+
sudo chown -R vscode:vscode /usr/local/cargo
6+
47
echo "Installing VSIX dependencies..."
58
npm install --prefix vsix
69
(cd vsix && npx vsce package -o ../docgraph.vsix)

0 commit comments

Comments
 (0)